[jboss-user] [JBoss Messaging] - How to handle a Connection object to remote jms server

Tim Coninx do-not-reply at jboss.com
Tue Jun 21 09:32:17 EDT 2011


Tim Coninx [http://community.jboss.org/people/timconinxrvp] created the discussion

"How to handle a Connection object to remote jms server"

To view the discussion, visit: http://community.jboss.org/message/611208#611208

--------------------------------------------------------------
Hello,

We are using an application that contains a jboss @Service mbean which encapsulates a javax.jms.Connection object.

During startup of the mbean the connection is created by initializing a remote InitialContext, looking up the ConnectionFactory from that context, and creating a connection from that factory:

@Service
public class JMSPublisher extends etcc.... {
  private Connection connection;
  protected void startService() {
    Context ctx = getRemoteInitialContext();
    ConnectionFactory connectionFactory = (ConnectionFactory) ctx.lookup("ConnectionFactory");
    connection = connectionFactory.createConnection();
  }
}


My question is: how long can we be supposed to maintain that connection ? In practise we see that the connection throws a JMSException when we try to create a session on it after an undefined amount of time.

The documentation of Connection tells us that an object represents a socket, so timeouts due to inactivity could be normal. But how can we deal with it without creating new connections for each and every message ?
Insert mo,
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/611208#611208]

Start a new discussion in JBoss Messaging at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2042]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110621/607145e9/attachment.html 


More information about the jboss-user mailing list