Announcement Announcement Module
Collapse
No announcement yet.
Could not refresh JMS Connection - retrying in 5000 ms Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Could not refresh JMS Connection - retrying in 5000 ms

    I am attempting, without much luck, to perform a fairly simple test with Spring/ActiveMQ. I create a durable topic T and then subscribe to it with a DefaultMessageListenerContainer pointing at a MessageListener implementing POJO.

    No matter what I do, I get the following every 5 seconds in my logs:

    Code:
    [dWinContainer-1] 2007-09-04 18:08:39,007 INFO  efaultMessageListenerContainer  - Could not refresh JMS Connection - retrying in 5000 ms
    javax.jms.InvalidClientIDException: Broker: localhost - Client: addWin already connected
            at org.apache.activemq.broker.region.RegionBroker.addConnection(RegionBroker.java:204)
            at org.apache.activemq.broker.BrokerFilter.addConnection(BrokerFilter.java:82)
            at org.apache.activemq.advisory.AdvisoryBroker.addConnection(AdvisoryBroker.java:70)
            at org.apache.activemq.broker.BrokerFilter.addConnection(BrokerFilter.java:82)
            at org.apache.activemq.broker.MutableBrokerFilter.addConnection(MutableBrokerFilter.java:92)
            at org.apache.activemq.broker.TransportConnection.processAddConnection(TransportConnection.java:706)
            at org.apache.activemq.broker.jmx.ManagedTransportConnection.processAddConnection(ManagedTransportConnection.java:86)
            at org.apache.activemq.command.ConnectionInfo.visit(ConnectionInfo.java:121)
            at org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:294)
            at org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:185)
            at org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:65)
            at org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:133)
            at org.apache.activemq.transport.InactivityMonitor.onCommand(InactivityMonitor.java:122)
            at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:84)
            at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:137)
            at java.lang.Thread.run(Thread.java:619)
    Here is my ActiveMQ configuration:

    Code:
    <beans>
      <broker brokerName="localhost" useJmx="true" xmlns="http://activemq.org/config/1.0">
        <destinations>
            <topic physicalName="game.profile.registered" />
            <topic physicalName="game.profile.won" />
        </destinations>
    
        <persistenceAdapter>
            <journaledJDBC journalLogFiles="5" dataDirectory="${activemq.base}/activemq-data" dataSource="#derby-ds"/>
        </persistenceAdapter>
    
        <transportConnectors>
           <transportConnector name="openwire" uri="tcp://localhost:61616" discoveryUri="multicast://default"/>
           <transportConnector name="ssl"     uri="ssl://localhost:61617"/>
           <transportConnector name="stomp"   uri="stomp://localhost:61613"/>
        </transportConnectors>
    
        <networkConnectors>
        </networkConnectors>
    
      </broker>
    
      <bean id="derby-ds" class="org.apache.derby.jdbc.EmbeddedDataSource">
        <property name="databaseName" value="derbydb"/>
        <property name="createDatabase" value="create"/>
      </bean>
    </beans>
    And here is my spring configuration:

    Code:
    <beans>
        <bean id="jmsConnectionFactory" class="org.apache.activemq.spring.ActiveMQConnectionFactory">
            <property name="brokerURL" value="tcp://my.server.com:61616"/>
            <property name="useBeanNameAsClientIdPrefix" value="true"/>
        </bean>
            
        <bean id="profileWonTopic" class="org.apache.activemq.command.ActiveMQTopic">
            <property name="physicalName" value="game.profile.won"/>    
        </bean>
        <bean id="addWinListener" class="my.package.AddWinApi"/>
        <bean id="addWinContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
            <property name="maxConcurrentConsumers" value="1"/>
            <property name="connectionFactory" ref="jmsConnectionFactory" />
            <property name="destination" ref="profileWonTopic" />
            <property name="messageListener" ref="addWinListener" />
            <property name="sessionAcknowledgeModeName" value="CLIENT_ACKNOWLEDGE"/>
            <property name="subscriptionDurable" value="true"/>
            <property name="clientId" value="addWin"/>
            <property name="durableSubscriptionName" value="addWin"/>
        </bean>
    </beans>
    I've tried a number of things, but I feel like I am missing something very basic...

    Also, as a secondary issue -- I'm not sure I understand the concurrent consumers thing. If I have multiple consumers, don't they ALL see the same message and try to process it -- thereby requiring me to ensure that my service safely ignores duplicate attempts to process the same thing (which seems counterintuitive to me).

    Your help greatly appreciated!

  • #2
    Hi,

    I've tested my sample with your configuration but I didn't see this message. Which version of AMQ do you use?

    2nd question: I think this is because you have a JMS topic and not a JMS queue. I had the same problems of understanding.

    Comment


    • #3
      I get the same INFO message when I connect a 2nd client as consumer with the same clientId property. If you use durable subscriptions you must specify a unique clientId value for each consumer.

      Comment


      • #4
        Originally posted by akuhtz View Post
        I get the same INFO message when I connect a 2nd client as consumer with the same clientId property. If you use durable subscriptions you must specify a unique clientId value for each consumer.
        I'm using ActiveMQ 4.1.1.

        I'm confused as to why there would be more than 1 client based on my bean configuration. Isn't the "client" in this case the consumer within the container? If so, how would I be getting more than 1? I specified a single consumer maximum...

        Like I said, I think I'm missing something really obvious... now if I only I knew what that was :-)

        Any ideas?

        Comment


        • #5
          I've tested with the current 5.0-SNAPSHOT .... download it and check if the problem still exists. You could also check with the JConsole how many consumers are currently connected.

          Comment


          • #6
            I think my question is this--

            How can I get a name collision with the clientId for a single DMLC whose max everything is set to 1?

            Comment

            Working...
            X