Is JMS message doesnt rollback to queue in exceptional case spring batch JMSItemReader implementation -
in development work have use spring batch jmsitemreader read messages hornetq. trying test scenario rollback jms messages queue in case errors occurs in spring batch process. doesnt work me.
for ex: spring step execution table showing rollback count 1. doesnt rollback message queue.
i used following configuration in xml.
<batch:job id="submitorderjmstowebservicejob"> <batch:step id="submitorderjmstolocatestep"> <batch:tasklet transaction-manager="mytxmanager"> <batch:chunk reader="jmsmessagereader" reader-transactional-queue="true" processor="jmsmessageprocessor" writer="jmsmessagetowebsevicewriter" commit-interval="1" /> </batch:tasklet> </batch:step> </batch:job> <bean id="jmsmessagereader" class="org.springframework.batch.item.jms.jmsitemreader"> <property name="jmstemplate" ref="orderjmstemplate" /> </bean> <bean id="mytxmanager" class="org.springframework.jms.connection.jmstransactionmanager"> <property name="connectionfactory" ref="connectionfactory"/> </bean>
i solved issue using following property in spring jms template bean.
<property name="sessiontransacted" value="true" />
now jms message rollback. note: have removed older configuration transaction-manager attribute in tasklet tag , transactional queue=true in chunk.
Comments
Post a Comment