Hi,
I am using DefaultMessageListnerContainer with sessionTransacted=true and also jdbc transaction manager but jms messages are committed first and picked up by internal queue before database commit. I am not using annotation based transaction. Below is the config i am using,
Code:<bean id="jmsContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer"> <property name="connectionFactory" ref="connectionFactory" /> <property name="destination" ref="destinationQueue" /> <property name="messageListener" ref="messageListner" /> <property name="taskExecutor" ref="taskExecutor" /> <property name="sessionTransacted" value="true" /> <property name="transactionManager" ref="txManager" /> <property name="cacheLevel" value="1"/> <property name="autoStartup" value="true" /> </bean>All other test cases are working fine like redelivery of message in case of database failure or internal queue write failure but because jms commit is happening prior to database commit, internal queue not able to find message in database to process. Sometime in second retry it works fine but there are times when internal not able able to find message in database even after 3-4 retry.Code:<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource"/> </bean>
Is there anyway to synchronize jms commit with jdbc commit to get rid of this issue. I do not want jms commit before database commit because in that case for any reason if application fails to write to internal queue, i can not rollback database changes.
So is there any way to make jms commit and database commit at the same time?


Reply With Quote