Spring batch Spring批处理条件流配置错误
我有一个配置了XML的步骤,我想添加Spring batch Spring批处理条件流配置错误,spring-batch,xml-configuration,Spring Batch,Xml Configuration,我有一个配置了XML的步骤,我想添加batch:next元素,以便在我的作业中获得条件流: <batch:step id="stepLoadCashFlows"> <batch:next on="*" to="stepCleanOldTrades" /> <batch:next on="FAILED" to="stepCleanCurrentTradesOnError" /> <batch:task
batch:next
元素,以便在我的作业中获得条件流:
<batch:step id="stepLoadCashFlows">
<batch:next on="*" to="stepCleanOldTrades" />
<batch:next on="FAILED" to="stepCleanCurrentTradesOnError" />
<batch:tasklet>
<batch:chunk reader="cashFlowItemReader" writer="cashFlowItemWriter"
processor="cashFlowsProcessor" commit-interval="10000" skip-limit="${cds.skip.limit}">
<batch:skippable-exception-classes>
<batch:include class="org.springframework.integration.transformer.MessageTransformationException" />
</batch:skippable-exception-classes>
</batch:chunk>
</batch:tasklet>
<listeners>
<listener ref="cashFlowWriterListener" />
</listeners>
</batch:step>
那么,我应该将这些元素放在哪里(我在步骤末尾尝试过,在tasklet内部…?transitions元素应该放在
tasklet
元素之后。因此,在您的情况下,以下各项应起作用:
<batch:step id="stepLoadCashFlows">
<batch:tasklet>
<batch:chunk reader="cashFlowItemReader" writer="cashFlowItemWriter"
processor="cashFlowsProcessor" commit-interval="10000" skip-limit="${cds.skip.limit}">
<batch:skippable-exception-classes>
<batch:include class="org.springframework.integration.transformer.MessageTransformationException" />
</batch:skippable-exception-classes>
</batch:chunk>
<batch:listeners>
<batch:listener ref="cashFlowWriterListener" />
</batch:listeners>
</batch:tasklet>
<batch:next on="*" to="stepCleanOldTrades" />
<batch:next on="FAILED" to="stepCleanCurrentTradesOnError" />
</batch:step>
请注意,listeners
元素应该位于tasklet
元素中。相关xsd文件:
<batch:step id="stepLoadCashFlows">
<batch:tasklet>
<batch:chunk reader="cashFlowItemReader" writer="cashFlowItemWriter"
processor="cashFlowsProcessor" commit-interval="10000" skip-limit="${cds.skip.limit}">
<batch:skippable-exception-classes>
<batch:include class="org.springframework.integration.transformer.MessageTransformationException" />
</batch:skippable-exception-classes>
</batch:chunk>
<batch:listeners>
<batch:listener ref="cashFlowWriterListener" />
</batch:listeners>
</batch:tasklet>
<batch:next on="*" to="stepCleanOldTrades" />
<batch:next on="FAILED" to="stepCleanCurrentTradesOnError" />
</batch:step>