0 Replies Latest reply: Jun 30, 2011 9:06 AM by 452196 RSS

    Do I really need two connection pools when using two durable subscriptions?

    452196
      I have a Spring daemon which takes messages from two different topics and stores them in a database.

      What irritates me is that I can't get it to work with a single connection pool. I get a message that I can't create durable subscriptions without a unique client id on the connection. It's not enough that the client id be set on the listener container, I have to set it on the underlying ConnectionFactory. I though this was some kind of glitch with openMQ but activeMQ gives me exactly the same behaviour.

      This is the important part of the config
          <bean id="realCon" class="org.apache.activemq.ActiveMQConnectionFactory" p:brokerURL="discovery:(multicast://default?group=live)"
          p:clientID="DB_RECORD_CLIENT"/>
          <bean id="realCon2" class="org.apache.activemq.ActiveMQConnectionFactory" p:brokerURL="discovery:(multicast://default?group=live)"
          p:clientID="DB_LOG_CLIENT"/>
          <bean id="jmsConnectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory"
          p:targetConnectionFactory-ref="realCon"/>
      
          <bean id="jmsConnectionFactory2" class="org.springframework.jms.connection.CachingConnectionFactory"
          p:targetConnectionFactory-ref="realCon2"/>
      
          <bean id="ocsMessageListener" class="com.cc.mer.ordercatcher.MessageReceived"/>
          <bean id="logMessageListener" class="com.cc.mer.ordercatcher.LogMessageReceived"/>
      
          <jms:listener-container
              connection-factory="jmsConnectionFactory"
              destination-type="durableTopic"
              transaction-manager="transactionManager"
              acknowledge="transacted"
              
      
              >
              <jms:listener ref="ocsMessageListener" destination="OCS_RELAYED"
                            subscription="ocs.db.recording" />
          </jms:listener-container>
          <jms:listener-container
              connection-factory="jmsConnectionFactory2"
              destination-type="durableTopic"
              transaction-manager="transactionManager"
              acknowledge="transacted"
              >
              <jms:listener ref="logMessageListener" destination="OCS_LOG"
                            subscription="ocs.log.recording" />
          </jms:listener-container>