Chapter 12. Message-Driven Beans
The message-driven bean was introduced in EJB 2.0 to support the processing of asynchronous messages from a JMS provider. EJB 2.1 expanded the definition of the message-driven bean so that it can support any messaging system, not just JMS through the JCA. EJB 3.0 does not really expand on the feature set of earlier specification versions, but it does simplify configuration with the use of annotations. This chapter examines both JMS-based message-driven beans as well as the expanded message-driven bean model available to EJB 3.0 developers.
JMS and Message-Driven Beans
All EJB 3.0 vendors must support a JMS provider. Most vendors have a JMS provider built in and must support other JMS providers through the JCA. However, regardless of whether your vendor has its own JMS provider or allows you to integrate some other provider, a JMS provider is an absolute necessity for supporting message-driven beans. By forcing the adoption of JMS, Sun has guaranteed that EJB developers can expect to have a working JMS provider on which messages can be both sent and received.
JMS as a Resource
JMS is a vendor-neutral API that can be used to access enterprise messaging systems. Enterprise messaging systems (a.k.a. message-oriented middleware) facilitate the exchange of messages between software applications over a network. The role of JMS isn’t unlike the role of JDBC: just as JDBC provides a common API for accessing many different relational databases, JMS provides ...