Skip Headers

Oracle® Application Server Containers for J2EE Enterprise JavaBeans Developer's Guide
10g Release 2 (10.1.2)
Part No. B15505-01
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

MDB Overview

A Message-Driven Bean (MDB) is a Java Message Service (JMS) message listener that can reliably consume messages from a queue or a topic. An MDB uses the asynchronous nature of a JMS listener with the benefit of the EJB container, which does the following:

Within normal JMS objects, a JMS message listener exists and must explicitly specify the consumer and its factory within its code. When you use MDBs, the container specifies the consumer and its factory for you; thus, an MDB is an easy method for creating a JMS message listener. You still have to retrieve the objects and create them given the interface, but the container does most of the work for you.

The OC4J MDB interacts with a JMS provider. This chapter highlights two JMS providers, OracleAS JMS and Oracle JMS, each of which must be installed and configured appropriately.

The following are generic steps to create and enable an MDB with a JMS provider:

  1. Install the JMS provider.

  2. Configure the JMS provider, the Destination objects for the MDB, and connection details for the MDB where the provider is installed.

  3. Configure OC4J with the JMS provider details in the OC4J XML files.

  4. Implement the MDB and map the JMS Destination objects used in its deployment descriptors.

This chapter describes how to implement each of these steps with both the OracleAS JMS and Oracle JMS providers. Each section uses an MDB example that is available for download from the OC4J sample code page at on the OTN Web site.

The main MDB implementation and the EJB deployment descriptor can be the same for both JMS types and is shown in the "MDB Example". The OC4J-specific deployment descriptor for this MDB and the JMS configuration is different for each JMS type, so these are described specifically in each of the provider sections.