Hi All,
I may be doing this incorrectly; but it seems CompositeItemWriter does not register the StepExecutionListener correctly if one it's delegate ItemWriter implements the StepExecutionListener interface.
Here is the Job:
Here is the Composite writer definitionCode:<batch:job id="testJob"> <batch:step id="step1"> <batch:tasklet> <batch:chunk commit-interval="2" > <batch:reader> <ref bean="itemReader"/> </batch:reader> <batch:processor> <ref bean="itemProcessor"/> </batch:processor> <batch:writer> <ref bean="compositeWriter"/> </batch:writer> <batch:streams> <batch:stream ref="documentAccumulatorWriter"/> </batch:streams> </batch:chunk> </batch:tasklet> </batch:step> <batch:listeners> <batch:listener ref="documentAccumulatorWriter"/> </batch:listeners> </batch:job>
Here is the ItemListener Class DefinitionCode:<bean id="compositeWriter" class="org.springframework.batch.item.support.CompositeItemWriter"> <property name="delegates"> <list> <ref bean="documentAccumulatorWriter"/> </list> </property> </bean>
The JobExecutionListener and ItemStream are working, the problem is just with StepExecutionListener.Code:public class DocumentAccumelatorItemWriter implements ItemWriter<ClaimPrintBatch>, StepExecutionListener, JobExecutionListener, ItemStream{
At the moment I am just playing around with a prototype; but was really hoping to use the CompositeWriter. Please let me know if it's something I am doing wrong or if there is a way to get around this issue. Thank you.


Reply With Quote