Hello to All,

I'm going crazy here, so any help would be appreciated. :-)

Trying to set up a simple Spring Batch Remote Chunking Sample. Here is what I do (only the relevant parts):



<import resource="/job-launcher-context.xml"/>
<import resource="/job-reader-context.xml"/>
<import resource="/job-thread-scope-context.xml"/>
<import resource="/job-activemq-connections.xml"/>




<!-- Used to send messages to a particular channel -->
<bean id="messagingGateway" class="org.springframework.integration.core.Messag ingTemplate">
<property name="defaultChannel" ref="requests" />
<property name="receiveTimeout" value="1000" />
</bean>



<int:channel id="requests" />
<!-- <int:channel id="incoming" /> -->


<!-- <int:transformer input-channel="incoming" output-channel="replies" ref="headerExtractor" method="extract" />
<bean id="headerExtractor" class="org.springframework.batch.integration.chunk .JmsRedeliveredExtractor"/> -->


<!-- Used to send messages from the queue to the Queue itself -->
<int-jms:outbound-channel-adapter connection-factory="connectionFactory" channel="requests" destination-name="REQUESTS.QUEUE" />



<!-- Nothing unusual really, just a spring batch job -->
<job id="jobRemoteChunk" xmlns="http://www.springframework.org/schema/batch">
<step id="stepRemoteChunk">
<tasklet>
<chunk reader="fileReader" writer="writer" commit-interval="4" />
</tasklet>
</step>
</job>


<bean id="writer" class="com.springBatch.helloWorld.LogWriter"></bean>



<!-- makes the step configurable for remote chunking. It transforms a chunk oriented step into a remote chunk-oriented step -->
<bean id="chunkHandler" class="org.springframework.batch.integration.chunk .RemoteChunkHandlerFactoryBean">
<property name="chunkWriter" ref="chunkWriter" />
<property name="step" ref="stepRemoteChunk" />
</bean>


<bean id="chunkWriter" class="org.springframework.batch.integration.chunk .ChunkMessageChannelItemWriter" scope="step">
<property name="messagingOperations" ref="messagingGateway" />
<property name="replyChannel" ref="replies" />
<property name="maxWaitTimeouts" value="10" />
</bean>



<int:channel id="replies" scope="thread">
<int:queue />
<int:interceptors>
<bean id="pollerInterceptor" class="org.springframework.batch.integration.chunk .MessageSourcePollerInterceptor">
<property name="messageSource">
<bean class="org.springframework.integration.jms.JmsDest inationPollingSource">
<constructor-arg>
<bean class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="connectionFactory" />
<property name="defaultDestinationName" value="replies" />
<property name="receiveTimeout" value="100" />
</bean>
</constructor-arg>
</bean>
</property>
<!-- <property name="channel" ref="incoming"/> -->
<property name="channel" ref="replies"/>
</bean>
</int:interceptors>
</int:channel>


And call the Job.

Expected : The writer does not gets called, instead the Job is "taken" to the JMS Queue where I need a slvae listener.
Actual: The Writer does start and nothing "chunking" happens, like the chunkHandler is ignored.

Now, if I remove the writer="writer" and replace it with writer="chunkWriter" everything seems to be working fine, but then what is the use of the chunkHandler?

Thank You,
Eugene.