JMS Session Pooling with Message Listener

246 Views Asked by At

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.

0

There are 0 best solutions below