Message-driven beans (MDBs) are stateless, server-side, transaction-aware components for processing asynchronous JMS messages. Introduced since EJB 2.0, message-driven beans process messages delivered via the Java Message Service.
Message-driven beans can receive JMS messages and process them using the same robust component-based infrastructure that session and entity beans enjoy. While a message-driven bean is responsible for processing messages, its container takes care of automatically managing the component’s entire environment including transactions, security, resources, concurrency, message
One of the most important aspects of MDBs is that they can consume and process messages concurrently. This capability provides a significant advantage over traditional JMS clients, which must be custom-built to manage resources, transactions, and security in a multi-threaded environment.
Before the release 3.0 of EJB also MDB needed a configuration file describing its properties, now let's see an example of MDB using annotations. it turns out that writing an MDB is just a matter of a few minutes: