EJB MDB Client

The MDB client sends a message to the queue, which is processed at some later time by the MDB. The code in the client looks very much like the code we would expect to see in any messaging client. It creates an InitialContext connected to the naming service and then requests a reference to the QueueConnection factory. The QueueConnectionFactory is then used to create a QueueConnection, which is then used to create a QueueSession. (The message queues or subscription topics would have been created previously by an administrator.)

Now that we have a session, we need to obtain a reference to the specific queue for the MDB. the naming service returns the reference to the queue. The connection is then used to create a session, which is ...

Get J2EE™ and Beyond: Design, Develop, and Deploy World-Class Java™ Software now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.