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)

4

1 回答 1

0

如果您使用的是 MDB,它们是容器管理的对象,则连接、会话、队列/主题和实际使用者都由容器管理。

您只需为 编写代码onMessage(Message m),就是这样。

于 2013-10-10T22:03:00.960 回答