BatchFilter
插件公共配置
<filters>
<filter id="publicFilter" class="PublicFilter" />
<filter id="batchFilter" class="BatchFilter">
<parameter name="lines" value="10" />
<parameter name="threadnum" value="10" />
<parameter name="call_interface" value="test1" />
<parameter name="call_transaction" value="BATCH_CALL" />
</filter>
<filter id="fileFilter" class="FileFilter">
<parameter name="record_strategy" value="bysplit" />
<parameter name="record" value="\r\n" />
<parameter name="field_strategy" value="bysplit" />
<parameter name="field" value="|+|" />
</filter>
</filters>
属性 |
描述 |
值类型 |
示例 |
id |
标识 |
string |
batchFilter |
type |
实例 |
string |
BatchFilter |
属性 |
描述 |
值类型 |
示例 |
Name |
标识 |
string |
lines、threadnum、call_interface、call_transaction |
value |
值 |
string |
当前字段的值 |
接口配置实现
属性 |
描述 |
值类型 |
示例 |
ref |
引用 |
string |
引用已经定义好的batchFilter对象 |
type |
数据流向 |
string |
in |
<transaction id="testbatch" detail="e:/total.txt">
<step id="1">
<connection ref="fileConnection" type="in">
<property name="path" value="e:/123.txt" />
<property name="type" value="list" />
</connection>
<filter ref="batchFilter" type="in">
</filter>
<filter ref="publicFilter" type="in">
<field tag="results" value="${this}" scope="step" />
<field tag="len" value="${getArrayLen()}" scope="transaction">
<argument id="1" value="${results}" />
</field>
</filter>
<foreach tag="i" begin="0" end="${len}" step="1">
<filter ref="publicFilter" type="in">
<field tag="result[${i}]" value="${getFutureValue()}" scope="step">
<argument id="1" value="${results[i]}" />
</field>
<if condition="${result[i].success}">
<log value="${result[i].content}" />
<log value="子线程${i}执行成功\r\n" />
</if>
<else>
<log value="${result[i].content}" />
<log value="子线程${i}执行失败\r\n" />
</else>
</filter>
</foreach>
</step>
</transaction>
<transaction id="BATCH_CALL" detail="">
<process>
<step id="ready" />
<step id="handle" />
<exception id="exception" />
</process>
<step id="ready">
<filter ref="publicFilter" type="in">
<field tag="curLine" value="${this[1]}" scope="transaction" />
<field value="${this[0]}" scope="this" />
</filter>
</step>
<step id="handle">
<filter ref="publicFilter" type="in">
<field tag="len" value="${getArrayLen()}" scope="step">
<argument id="1" value="${this}" />
</field>
</filter>
<filter ref="fileFilter" type="in">
<foreach tag="i" begin="0" end="${len}" step="1" condition="${next()}">
<log value="正在执行第${i+curLine}行\n" />
<field tag="t1_no[${i}]]" etag="0" type="int" scope="transaction" />
<field tag="t2_no[${i}]]" etag="0" type="int" scope="transaction" />
</foreach>
</filter>
<filter ref="publicFilter" type="in">
<field value="${super.logbuffer}" scope="this" />
</filter>
</step>
<step id="exception">
<filter ref="publicFilter" type="in">
<field value="第${curLine}行到第${curLine+rows-1}行执行失败\n" scope="this" />
</filter>
</step>
</transaction>