A Message-Driven Bean (MDB) implements business logic in an asynchronous fashion. The client does not receive a response to the message from the MDB. A client will send a message to a queue or topic. The message is then retrieved and processed by the MDB. A queue differs from a topic in that a message in a queue is sent to a single MDB. In contrast, a message in a topic will be sent to each MDB that is registered with that topic.
From the client's perspective, the MDB is anonymous. There is no way for the client to identify or otherwise select a specific MDB. The EJB container decides which MDB object to use in response to a request. In order to send a message to an MDB, the client can use dependency injection or JNDI lookup to locate the queue or topic.
MDBs are managed by the server EJB container. The EJB container will treat all instances of the same MDB class identically. A message will be delivered to the next available instance of the MDB. The container will create and...