Java Reference
In-Depth Information
Adding
message-driven
beans
to
your
application
Once we the configuration, we can start coding a JMS message consumer such as
the message-driven bean.
Message-driven beans ( MDBs ) are stateless, server-side, and transaction-aware
components for processing asynchronous JMS messages.
One of the most important aspects of message-driven beans is that they can con-
sume and process messages concurrently. This capability provides a significant ad-
vantage over traditional JMS clients, which must be custom-built to manage re-
sources, transactions, and security in a multithreaded environment. The MDB con-
tainers manage concurrency automatically, so the bean developer can focus on the
business logic of processing the messages. The MDB can receive hundreds of JMS
messages from various applications and process them all at the same time, because
numerous instances of the MDB can execute concurrently in the container.
From the semantic point of view, an MDB is classified as an enterprise bean, just
like a session or entity bean, but there are some important differences. At first, the
message-driven bean does not have component interfaces. The component inter-
faces are absent because the message-driven bean is not accessible via the Java
RMI API; it responds only to asynchronous messages.
Just as the entity and session beans have well-defined life cycles, so does the MDB
bean. The MDB instance's life cycle has two states: Does Not Exist and Method
ready Pool :
When a message is received, the EJB container checks to see if any MDB instance
is available in the pool. If a bean is available in the free pool, JBoss uses that in-
Search WWH ::




Custom Search