Skip Headers
Oracle® Fusion Middleware Programming Message-Driven Beans for Oracle WebLogic Server
12c Release 1 (12.1.1)

Part Number E24977-02
Go to Documentation Home
Home
Go to Table of Contents
Contents
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

1 Understanding Message-driven Beans

A message-driven bean (MDB) is an enterprise bean that allows Java EE applications to process messages asynchronously. An MDB acts as a JMS or JCA message listener, which is similar to an event listener except that it receives messages instead of events. The messages may be sent by any Java EE component—an application client, another enterprise bean, or a Web component—or by non-Java EE applications.

These are the key features of message-driven beans:

When a message arrives, the container calls the message-driven bean's onMessage method to process the message. The onMessage method may call helper methods, or it may invoke a session or entity bean to process the information in the message or to store it in a database.

A message may be delivered to a message-driven bean within a transaction context, so that all operations within the onMessage method are part of a single transaction. If message processing is rolled back, the message will be re-delivered.

For information about design alternatives for message-driven beans, see MDBs and Messaging Models.

For a description of the overall EJB development process, see Programming Enterprise JavaBeans for Oracle WebLogic Server

JCA-Based MDBs

MDBs can be configured to receive messages from JCA 1.5-compliant resource adapters, as defined by the JCA specification. To configure a MDB to use JCA, set the resource-adapter-jndi-name deployment descriptor.

For more information, see the JCA 1.5 specification and "resource-adapter-jndi-name" in Programming Enterprise JavaBeans, Version 2.1, for Oracle WebLogic Server.