Message Driven Beans (MDBs) are messaging objects designed to route messages from clients to other Enterprise Java Beans. In the WebLogic adapter, MDBs are only supported with asynchronous communication with JMS. However, Message Driven Beans deal with asynchronous subscription/publication of JMS messages in a different manner than Entity and Session Beans (EJB 2.0 specification). Message Driven Beans are often compared to a Stateless Session Bean in that it does not have any state context. A Message Driven Bean differs from Session and Entity Beans in that it has no local/ remote or localhome/home interfaces. An MDB is not exposed to a client at all. The MDB simply subscribes to a Topic or a Queue, receives messages from the container through the Topic or Queue, and then process the messages it receives from the container.
An MDB implements two interfaces:
javax.ejb.MessageBean
javax.jms.MessageListener
Minimally, the MDB must implement the setMessageDrivenContext, ejbCreate, and ejbRemove methods from the javax.ejb.MessageBean interface. In addition, the MDB must implement the onMessage method of the javax.jms.MessageListener interface. The container calls the onMessage method, passing in a javax.jms.Message, when a message is available for the MDB.