0

Relating to this question (JMS Connection Pooling in Message Listener), i'm currently trying to build a session pool upon a pool of connections that i'd created earlier.

I had managed to create a pool of JMS Connections and when i run it with my Producers and Consumers, they work fine. The Consumers is registered with a Message Listener to retrieve messages from the MQ.

However when i implemented the session pool, the message listener just stop working. The producers can send message out without problem, but the message listener never fired off.

The following code is the create code in the JmsSessionObjectFactory:

Connection connection = Application.getInstance().getConnectionPool().borrowObject();
Session session = connection.createSession(true, Session.SESSION_TRANSACTED);
Application.getInstance().getConnectionPool().returnObject(connection);

Is that the correct way to implement the factory creation for a session? Or my concept of session pooling with the connection pool is wrong?

Appreciate any advice. Thank you.

Community
  • 1
  • 1
ipohfly
  • 1,959
  • 6
  • 30
  • 57
  • are you running this on an app server or a standalone way? what JMS impl? – John Ament Nov 28 '14 at 20:07
  • this is run as a standalone app. the app is listening on a port to receive info and send them over JMS Producer to a IBM MQ, and also register Consumer with `MessageListener` to retrieve message from the MQ – ipohfly Nov 30 '14 at 02:52
  • post some code, otherwise, it's impossible to know what you're doing beyond your description. BTW, JMS connections are thread-safe, – raffian Dec 02 '14 at 21:31

0 Answers0