Show TOC

Procedure documentationConsuming Messages from Message-Driven Beans Locate this document in the navigation structure

 

The message driven-beans (MDBs) are Enterprise JavaBeans whose purpose is to provide business logic, which is triggered asynchronously, for example by JMS messages. If an MDB is to be triggered by a JMS message, it has to implement the javax.jms.MessageListener interface. The only method in this interface is the onMessage() method, which is passed a JMS message as a parameter and contains the business logic of the MDB.

MDBs provide the easiest way to consume JMS messages because all the messaging specifics such as creating connections, sessions, consumers, managing failover, and so on, are transparent to MDB applications.

More information about the general usage and life cycle of message-driven beans: EJB Overview

Procedure

  1. You create an MDB.

    More information: Creating Message-Driven Beans

  2. You implement the MDB's onMessage() method.

  3. You set the required properties of the <bean-props> tag in the ejb-j2ee-engine.xml that concern the message-driven beans.

    More information: Editing the ejb-j2ee-engine.xml