My app (a spring message listener) reads from a queue and writes to the database in a single transaction. I use Atomikos to provide the XA transaction behaviour. When the app is abruptly terminated with kill statements for example, I see messages are lost. Is there any specific configuration I need to use? Should the queues be persistent? Currently the queues are non-persistent. My MQ version is v7.1.
Spring config for listener container looks like:
<bean id="listenerContainer" class="com.miax.test.TestListenerMDPImpl" autowire="byName"> <property name="connectionFactory" ref="mqConnFactory" /> <property name="destinationName" value="QUEUE" /> <property name="messageListener" ref="listenerAdapter" /> <property name="transactionManager" ref="jtaTransactionManager" /> <property name="sessionTransacted" value="true" /> <property name="concurrentConsumers" value="1" /> <!-- receive time out, should be less than tranaction time out --> <property name="receiveTimeout" value="3000" /> <!-- retry connection every 1 seconds --> <property name="recoveryInterval" value="1000" /> <property name="autoStartup" value="true" /> <property name="sessionAcknowledgeMode" value="0" /> </bean>
Any other info will be given as needed.
Thanks.