[jboss-user] [JBoss Messaging Users] - JMS connection/session handling

bdamato do-not-reply at jboss.com
Wed Sep 16 19:14:17 EDT 2009


What is the proper way to manage JMS connections and sessions? 

Should I always create a connection, create a session, DO THE WORK, then close the session, and the connection. Or, can I keep the connection and session open indefinitely and simply re-use them for as long as I want.

We've been trying to go with the re-use the session approach and for the most part, it works. It seems, however, that if the queue goes away (eg. if jboss is restarted), the client session running on a remote machine, never sees the queue go away or doesn't receive any sort of exception. So, when the queue does come back online, it appears that the session is disconnected and doesn't know it. It never resumes retrieving messages from the queue.

I've looked around at many tutorials, but they all show the simplistic approach of creating a new connection and session each time. Does JBoss have a recommended method? Is it inappropriate to re-use the connection and session?

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4255619#4255619

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4255619



More information about the jboss-user mailing list