users@glassfish.java.net

JMSJCA with Spring

From: <glassfish_at_javadesktop.org>
Date: Thu, 21 Jan 2010 05:13:40 PST

Hi

We are working on consuming messages from a Java CAPS 6.2 queue in our lightweight transaction processor. We use Spring and Jetty in all our applications, and inspired by Frank's article here: http://blogs.sun.com/fkieviet/entry/using_resource_adapters_outside_of I have tried to include JMSJCA into our application the same way that we use ActiveMQ and OpenMQ clients. The configuration is like this:

        <bean name="jmsConnectionFactoryFactory" class="com.stc.jmsjca.core.XMCFUnifiedXA">
                <property name="resourceAdapter">
                        <bean class="com.stc.jmsjca.unifiedjms.RAUnifiedResourceAdapter">
                                <property name="connectionURL"
                                        value="mq://${mq.host}:${mq.port}?JMSJCA.redeliveryhandling=4:10; 20:move(queue:dmq) &amp;JMSJCA.NoXA=true" />
                                <property name="userName" value="${mq.username}" />
                                <property name="password" value="${mq.password}" />
                        </bean>
                </property>
        </bean>

        <bean id="myConnectionFactory" class="com.example.MyConnectionFactory">
                <property name="connectionFactoryFactory" ref="jmsConnectionFactoryFactory" />
        </bean>

        <bean id="jmsContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
                <property name="connectionFactory" ref="myConnectionFactory" />
                <property name="destination" ref="myQueue" />
                <property name="messageListener" ref="myMessageListener" />
                <property name="sessionTransacted" value="true" />
                <property name="concurrentConsumers" value="${mq.numListeners}" />
        </bean>

where the myConnectionFactory is a simple class used to call createConnectionFactory() on the XMCFUnifiedXA, and delegate calls to the resulting ConnectionFactory.

This seems to work very well, and I am very happy about that, since I could find no examples of anyone doing the same thing.

The problem, however, is that the adapter doesn't seem to see the specified redelivery handling option. It does see the NoXA-option, so there is probably nothing wrong with the formatting or processing of the string, but failed messages are rolled back on the queue and taken off again in an endless fashion, and never moved to the dmq. In case there was a problem with creating the dmq, I have created it manually. I have also tried setting the option with the setOptions method, in addition to the url method.

I have tried the JMSJCA version supplied with CAPS 6.2.

It seems that CAPS may be using JMS 1.0.2, could that be correct? To use 1.0.2 I would need to get hold of a JConnectionFactoryQueueXA instance, but I can't find a way to do that. There is a Spring DefaultMessageListenerContainer102 available.


I would appreciate any help with this. Working on the battlefront between JEE and Spring isn't always trivial :|
[Message sent by forum member 'axelwathne' (awathne_at_gmail.com)]

http://forums.java.net/jive/thread.jspa?messageID=382136