The Message-driven Beans are the message consumers for the applications that send the messages. If an application sends a message to the destination that is the message listener for a Message-driven Bean, the Message-driven Bean receives the message and executes the processing as a consumer.
When a message arrives, the javax.jms.MessageListener#onMessage method, which is the message listener method of the Message-driven Beans, is invoked by the J2EE container. The processing is executed according to the business logic included in the message listener method.
The following figure shows the procedure of operating the Message-driven Beans.
Figure 7-12 Procedure of operating the Message-driven Beans
Note that the destination for operating the Message-driven Beans must be set up in the JNDI Namespace of the sending source J2EE applications.
The Message-driven Beans and the destination queues or topics are associated when the J2EE applications containing the Message-driven Beans are deployed in the J2EE server.