Sun Java System Message Queue 3.7 UR1 Technical Overview

JMS/J2EE Programming: Message-Driven Beans

In addition to the general JMS client programming model introduced in Chapter 2, Client Programming Model, there is a more specialized adaptation of a JMS client used in the context of J2EE platform applications. This specialized client is called a message-driven bean and is one of a family of Enterprise JavaBeans (EJB) components described in the EJB 2.0 (and later) Specification (http://java.sun.com/products/ejb/docs.html).

Message-driven beans provide asynchronous messaging; other EJB components (session beans and entity beans) can only be called synchronously, through standard EJB interfaces. However, enterprise applications often need asynchronous messaging, to allow server-side components to communicate without tying up server resources. Any application whose server-side components must respond to application events needs an EJB component that can receive and consume messages without being tightly coupled to the message producer. In enterprise applications, this capability must also scale under increasing load.

A message-driven bean (MDB) is an EJB component supported by a specialized EJB container, that provides distributed services for the components it supports.

Figure 5–1 Messaging with MDBs

Diagram showing JMS message producers sending messages to consuming
MDB instances in a J2EE environment.