WebSphere MQ and Atomicos - Messages Lost at Process End

My application (spring message listener) reads from the queue and writes to the database in one transaction. I use Atomikos to enforce XA transaction behavior. When an application suddenly terminates with kill commands, for example, I see that messages are lost. Is there any specific configuration I need to use? Should the queues be permanent? Queues are currently not permanent. My version of MQ is v7.1.

The spring config for the listener container looks like this:

<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 information will be provided as necessary.

Thanks.

+4
source share
1 answer

The client you use must be an advanced transactional client if it is loaded before May of this year. Any of the clients of V7.0.1 and higher as of May 2012 has a built-in XA feature. If in doubt, send the current version of the WMQ client and install.

Secondly, the XA transaction manager must have its own connection to the queue manager, regardless of the application. This means that it can connect and reconcile transactions if the application does not restart. To do this, the transaction manager must be configured using the XX_OPEN line and the switch file, as described in the Infocenter section Configuring XA-compatible Transaction Managers .

What is its value, in WMQ there is no such thing as a constant queue. Messages are permanent (or not). For more on this, see my related blog post . This is a pretty important question, because when people assume that the line itself is constant, they tend to develop solutions that produce unexpected results. Please read the blog post!

+4
source

Source: https://habr.com/ru/post/1434633/


All Articles