4

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.

arrehman
  • 1,322
  • 6
  • 31
  • 42

1 Answers1

4

The client you are using must be the Extended Transactional Client if downloaded prior to May of this year. Any of the V7.0.1 and higher clients as of May 2012 have the XA capability built in. If in doubt, go download a current release of the WMQ client and install.

Second, the XA transaction manager must have it's own connection to the queue manager independent of the application. This is so that it can connect and reconcile the transactions if the application fails to restart. To do this, the transaction manager must be configured with an XX_OPEN string and a switch file as described in the Infocenter topic Configuring XA-compliant transaction managers.

For what its worth, there is no such thing as a persistent queue in WMQ. It is the messages themselves that are persistent (or not). For more on that, please see my blog post on the topic. This is a rather important topic because when people assume that the queue itself is persistent they tend to devise solutions that produce unexpected results. Please read the blog post!

T.Rob
  • 31,522
  • 9
  • 59
  • 103
  • Is there any way to check if Extended Transactional Client is already installed or not? – arrehman Sep 17 '12 at 16:08
  • The `dspmqver -a` command would show the XTC for older clients. However, since it is now built into the client and no additional packages or files, I don't think it is broken out as a separate component. The best way to tell the difference between an old client without XTC and a new client is just to install the WMQ V7.5 client. Short of that, download the v7.0.1 or v7.1 client and reinstall. Sorry I don't have a better answer for V7.0.1 or V7.1 clients. Download links in your other recent question. – T.Rob Sep 17 '12 at 17:53
  • Thanks for the feedback, glad it was helpful! These questions on SO are helping me represent business requirements to the WMQ management and developers so thanks for posting them. – T.Rob Sep 25 '12 at 17:58
  • JMSDeliveryMode mentioned in http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=%2Fcom.ibm.mq.csqzaw.doc%2Fuj25450_.htm is the message level persistence property correct? – arrehman Sep 25 '12 at 18:39
  • Probably ought to post a new question on persistence so the next person searching on that topic will have a chance of finding it. Even if this question turns up in a search, the title would result in few people looking here. – T.Rob Sep 25 '12 at 19:00
  • One way perhaps to see if XTC is part of my client installation is to look for com.ibm.mqetclient.jar in /opt/mqm/java/lib. – arrehman Sep 25 '12 at 19:13
  • That tells you if you have an older client and have not reinstalled. If the new version of the V7.0 or higher client is installed, that component won't be there. Find it means you definitely have XA client, not finding it isn't definitive. – T.Rob Sep 25 '12 at 19:24
  • I definitely don't have it, currently going to get the May31,2012 update of 7.1.0.1 client. I guess then the classes that belong to com.ibm.mqetclient.jar is part of one of those core mq jars then, in the new versions. – arrehman Sep 25 '12 at 19:32