Announcement Announcement Module
No announcement yet.
CompositeItemWriter not registering StepExecutionListener Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • CompositeItemWriter not registering StepExecutionListener

    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:

    	<batch:job id="testJob">
    		<batch:step id="step1">
    				<batch:chunk commit-interval="2" >
    						<ref bean="itemReader"/>
    						<ref bean="itemProcessor"/>
    						<ref bean="compositeWriter"/>
    						<batch:stream ref="documentAccumulatorWriter"/>
    			<batch:listener ref="documentAccumulatorWriter"/>
    Here is the Composite writer definition
    	<bean id="compositeWriter" class="">
    		<property name="delegates">
    				<ref bean="documentAccumulatorWriter"/>
    Here is the ItemListener Class Definition

    public class DocumentAccumelatorItemWriter implements ItemWriter<ClaimPrintBatch>, StepExecutionListener, JobExecutionListener, ItemStream{
    The JobExecutionListener and ItemStream are working, the problem is just with StepExecutionListener.

    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.

  • #2
    Nothing wrong here. The composite writer should not register listeners because you might not want them to be registered (also because it is a cyclic dependency in the source). You have to register all listeners and streams explictly if they aren't the "main" reader, writer or processor in a step.