Hello,

I am not sure if this is an ActiveMQ issue, but my search so far as turned
up empty, so I have to start somewhere.
I am trying to setup a DefaultMessageListenerContainer using an ActiveMq
Durable subscriber (ActiveMQ 5.6.0), and Atomikos as TX manager for JTA,
configuring everything through Spring. I need to specify a clientId on the
connection for the durable subscriber. This is my config:
        <bean
                
class="org.springframework.jms.listener.DefaultMessageListenerContainer">
                <property name="connectionFactory" 
ref="jmsListenerConnectionFactory" />
                <property name="concurrentConsumers" value="1" />
                <property name="destinationName" value="topic.name" />
                <property name="durableSubscriptionName" value="durable.name" />
                <property name="subscriptionDurable" value="true" />
                <property name="messageListener" ref="integrationMdp" />
                <property name="transactionManager" ref="JtaTransactionManager" 
/>
                <property name="sessionAcknowledgeModeName" 
value="CLIENT_ACKNOWLEDGE" />
                <property name="pubSubDomain" value="true" />
                <property name="sessionTransacted" value="true" />
                <property name="clientId" value="msgListener" />
        </bean>

        <bean id="jmsListenerConnectionFactory"
class="com.atomikos.jms.AtomikosConnectionFactoryBean">
                <property name="uniqueResourceName" value="ActiveMQXAListener"/>
                <property name="maxPoolSize" value="1"/>
                <property name="xaConnectionFactory">
                        <bean 
class="org.apache.activemq.ActiveMQXAConnectionFactory">
                                <property name="brokerURL" 
value="${jms.brokerURL}"  />
                                <property name="userName" 
value="${jms.username}" />
                                <property name="password" 
value="${jms.password}" />
                        </bean>
                </property>
                <property name="localTransactionMode" value="false"></property>
        </bean>

If I do this, I will get the following exception:

[org.springframework.jms.listener.DefaultMessageListenerContainer#0-1] WARN 
com.atomikos.jms.AbstractJmsProxy  - Failed to create durable
TopicSubscriber: null 
javax.jms.JMSException: You cannot create a durable subscriber without
specifying a unique clientID on a Connection
        at
org.apache.activemq.ActiveMQConnection.checkClientIDWasManuallySpecified(ActiveMQConnection.java:1255)
        at
org.apache.activemq.ActiveMQSession.createDurableSubscriber(ActiveMQSession.java:1295)

On the other hand, if I set the clientId on the connectionFactory, I get the
following:

[org.springframework.jms.listener.DefaultMessageListenerContainer#0-1] WARN 
com.atomikos.jms.AbstractJmsProxy  - Could not create an XASession on the
javax.jms.XAConnectionFactory's XAConnection - check if your JMS backend is
configured for XA? 
javax.jms.InvalidClientIDException: Broker: localhost - Client: msgListener
already connected from tcp://127.0.0.1:57501
        at
org.apache.activemq.broker.region.RegionBroker.addConnection(RegionBroker.java:223)
        at
org.apache.activemq.broker.BrokerFilter.addConnection(BrokerFilter.java:85)
[...]
[org.springframework.jms.listener.DefaultMessageListenerContainer#0-1] WARN 
com.atomikos.jms.AbstractJmsProxy  - Error delegating 'createSession' call
to JMS driver 
javax.jms.InvalidClientIDException: Broker: localhost - Client: msgListener
already connected from tcp://127.0.0.1:57501
        at
org.apache.activemq.broker.region.RegionBroker.addConnection(RegionBroker.java:223)
        at
org.apache.activemq.broker.BrokerFilter.addConnection(BrokerFilter.java:85)
[...]


I seem to be caught in a catch-22 type problem here... Anyone had success
with this kind of config?

Thanks for your help,
Max

--
View this message in context: 
http://activemq.2283324.n4.nabble.com/problem-configuring-durable-subscriber-with-Spring-and-Atomikos-XA-issue-tp4654049.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to