users@glassfish.java.net

Re: JMSJCA with Spring

From: <glassfish_at_javadesktop.org>
Date: Wed, 17 Feb 2010 04:17:03 PST

Hi Axel,

I've been trying to do the same. We have a spring application with JMS endpoints, and need to implement some kind of fault handling, like what we can get from a ResourceAdapter.

Correct me if I'm wrong, but I thought that in order to use a ResourceAdapter, you needed to run it in a JCA-container, and not in the standard MessageListenerContainers that Spring primarly offers. So I thought that I had to use the MessageEndpointManager from Spring, instead of for example DefaultMessageListenerContainer.

The following Spring Configuration shows what I mean:
    <bean id="resourceAdapter" class="com.stc.jmsjca.unifiedjms.RAUnifiedResourceAdapter">
        <property name="connectionURL" value="mq://localhost" />
        <property name="priority" value="PRIORITY" />
        <property name="userName" value="user" />
        <property name="password" value="password" />
    </bean>
    <bean id="activationSpec" class="com.stc.jmsjca.unifiedjms.RAUnifiedActivationSpec">
        <property name="destination" value="q_test" />
        <property name="destinationType" value="javax.jms.Queue" />
        <property name="acknowledgeMode" value="Auto-acknowledge" />
        <property name="redeliveryHandling" value="1:1000;5:5000;10:10000;15:move(queue:dlq$)" />
    </bean>
    <bean id="endpointManager" class="org.springframework.jms.listener.endpoint.JmsMessageEndpointManager">
        <property name="resourceAdapter" ref="resourceAdapter" />
        <property name="activationSpec" ref="activationSpec" />
        <property name="messageEndpointFactory" ref="messageEndpointFactory" />
    </bean>
    <bean id="messageEndpointFactory" class="org.springframework.jms.listener.endpoint.JmsMessageEndpointFactory">
        <property name="messageListener" ref="dodgyMessageListenerDelegate" />
    </bean>
    <bean id="dodgyMessageListenerDelegate" class="com.colorline.jmstest.DodgyMessageListener">
    </bean>

Here I use Springs JCA-container (JmsMEssageEndpointManager) which connects through the ResourceAdapter.

The problem right now is that the Spring JCA-container only supports "Auto-acknowledge" and "Dups-ok-acknowledge" when setting acknowledgeMode. To complicate things further, we also are trying to use Atomikos as a XA-transaction-manager in the same application (I know, we should be in an Application server, but)

Have you gotten any longer with your approach to using this ResourceAdapter in Spring?


Regards,
Morten
[Message sent by forum member 'mortenberg' (mortenberg80_at_gmail.com)]

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