1

If I have a JMS queue and I wish to put a message on the queue from a publishing client, I need to first open a session, get the queue from its jndi name and then send the message to the queue.

But on the consumer side, how come I do not manually need to open a session and receive the message. Does the container always keep one open session per MDB (considering one MDB listening on one queue)

Victor
  • 16,609
  • 71
  • 229
  • 409

1 Answers1

0

If you're using MDB's, which are container-managed objects, the connection, session, queue/topic, and actual consumer are all managed by the container.

You just write the code for onMessage(Message m), that's it.

raffian
  • 31,267
  • 26
  • 103
  • 174
  • So each time a message comes on the queue the container will open a session between the MDB and the queue? – Victor Oct 10 '13 at 23:43
  • that depends on how the container handles it. It may keep the session open for resue, or it may not and create a new one for each messages. Check the documentation for the app server you're using. – raffian Oct 10 '13 at 23:54