Hi,
I am creating a step with reader reading items from spring integration message channel.
The "itemMsgQueue" is the message queue contains data. "item" is the channel which ItemReader will read from.
It works fine if I am using the "org.springframework.batch.integration.chunk.Messa geSourcePollerInterceptor" to poll directly from JMS MessageSource and send to the channel:
Code:<integration:channel id="items"> <integration:queue/> <integration:interceptors> <bean id="interceptor" class="org.springframework.batch.integration.chunk.MessageSourcePollerInterceptor"> <property name="messageSource"> <bean class="org.springframework.integration.jms.JmsDestinationPollingSource"> <constructor-arg> <bean class="org.springframework.jms.core.JmsTemplate"> <property name="connectionFactory" ref="connectionFactory" /> <property name="defaultDestinationName" value="itemsMsgQueue" /> <property name="receiveTimeout" value="100" /> </bean> </constructor-arg> </bean> </property> </bean> </integration:interceptors> </integration:channel> <integration:gateway service-interface="org.springframework.batch.item.ItemReader" id="itemReader" default-reply-channel="items" default-reply-timeout="5000"/> <batch:job id="TestJob"> <batch:step id="TestStep1"> <batch:tasklet> <batch:chunk commit-interval="3" reader="itemReader" processor="logProcessor" writer="nullWriter"> </batch:chunk> </batch:tasklet> </batch:step> </batch:job>
However, if I want to use the message-driven-channel-adapter to send the message to the channel instead, it doesn't seem to work. The job finished with 0 item readed:
Code:<integration:channel id="items"> <integration:queue capacity="1000" /> </integration:channel> <int-jms:message-driven-channel-adapter connection-factory="connectionFactory" destination-name="itemMsgQueue" channel="items" /> <integration:gateway service-interface="org.springframework.batch.item.ItemReader" id="itemReader" default-reply-channel="items" default-reply-timeout="5000"/> <batch:job id="TestJob"> <batch:step id="TestStep1"> <batch:tasklet> <batch:chunk commit-interval="3" reader="itemReader" processor="logProcessor" writer="nullWriter"> </batch:chunk> </batch:tasklet> </batch:step> </batch:job>
Is there anything wrong with the second configuration ? I thought it must work.
Thanks.
K.


Reply With Quote
