A message-driven bean (MDB) is an enterprise bean that is used in Java EE to receive and process messages asynchronously, whatever the messaging style used: point-to-point or publish-subscribe. Any other component—servlets; EJBs; other MDBs; or another Java EE, SE, or non-Java application—can send messages to be processed by message-driven beans. Message-driven beans act as the message listener in JMS.
Message-driven beans are similar to stateful session beans in that:
- They maintain no conversational state (stateless).
- All instances of message-driven beans are equal. Therefore, the application server can maintain a pool of them to serve many requests (messages) concurrently.
- A single instance of a message-driven bean can serve requests (messages) from different clients.
However, message-driven beans differ from session beans in that:
- They have no standard interface to access.
- They are indirectly accessible by sending message objects to the JMS destination those message-driven...