2 Replies Latest reply on Mar 7, 2011 7:51 AM by bnc119

    Closing HornetQ topic connections properly

    bnc119

      Hi,

       

      I am developing a native C++ JMS client that communicates with the JMS API through JNI.  We are using HornetQ 2.1.2 Final as our messaging vendor. The purpose of the client is to consume messages from one or more JMS topics. 

       

      While our client is running, we consume messages just fine and everything works properly.  During a run, I typically "tail"

      hornetq-2.1.2-Final/logs/hornetq.log  and observe no errors.

       

      During the client's shutdown sequence, each JMS connection is closed with the connection.close() statement.  The component shutsdown completely.

      Monitoring hornetQ inside jConsole shows "0" subscribers to the JMS topics I am interested in.  By all accounts it looks like I've disconnected and cleaned up properly.

       

      Now, if I send one more message to a topic which the client was just connected to a moment ago, the hornetQ log starts spewing:

       

       

      WARNING [org.hornetq.core.server.impl.ServerSessionImpl]  Client connection failed, clearing up resources for session 30dd0875-4117-11e0-ad1f-00221985f29c

      [hornetq-failure-check-thread] 14:43:09,230 WARNING [org.hornetq.core.server.impl.ServerSessionImpl]  Cleared up resources for session 30dd0875-4117-11e0-ad1f-00221985f29c

       

      Note:  The log starts spewing this message about 60 seconds after the last message is sent.  It doesn't appear right away.  After some time, the messages finally stops printing.

       

      Can anyone tell me what this message means and would could be causing it?

        • 1. Closing HornetQ topic connections properly
          hughbragg

          Normally I close the sender or receiver before rolling back any pending transactions if the session is transacted, close the session and finally close the connection just to make sure the server has been notified. I don't know if that helps.

           

          It looks like closing the connection doesn't close everything as it's supposed to but you'd need to post a working example to be sure.

          • 2. Closing HornetQ topic connections properly
            bnc119

            I realized what I was doing wrong: 

             

            Contrary to my belief, I did in fact have unclosed JMS connections in my system.  Namely, I was using some older test client code that *wasn't* closing connections, and it was these connection timeout messages that HornetQ was tossing around the logs.  If anyone else has this problem, using jconsole can be helpful for troubleshooting.  Once you have your jconsole window running and you are attached to your HornetQ process, click on the "mbeans" tab.  Click on org.hornetq-->Server-->JMS-->Operations.  Click on "listRemoteAddresses".  A window will appear showing all current subscribers with remote IP addresses and ports.