+

Search Tips   |   Advanced Search

 

Programming to use message-driven beans

 

Applications can use message-driven beans (a type of enterprise bean defined in the EJB specification) as asynchronous message consumers.

 

Overview

A client sends messages to the destination (or endpoint) for which the message-driven bean is deployed as the message listener. When a message arrives at the destination, the EJB container invokes the message-driven bean automatically without an application having to explicitly poll the destination. The message-driven bean implements some business logic to process incoming messages on the destination.

EJB 2.0 message-driven beans support only JMS messaging. EJB 2.1 message-driven beans can handle other messaging types in addition to JMS. The message-driven bean class must implement the message listener interface for the messaging type that the message-driven bean handles. For example, an EJB 2.1 message-driven bean class used for JMS messaging must implement the javax.jms.MessageListener interface.

You can use Rational Application Developer to develop applications that use message-driven beans. You can use the WAS runtime tools, like the console, to deploy and administer applications that use message-driven beans.

If you are developing message-driven bean applications for use with WebSphere MQ as an external JMS provider, write them so that they consume each message before the maximum retry limit is reached. If you do not do this, the listener port stops when the maximum retry limit is reached for any given message. It then becomes necessary to manually remove the message from the WebSphere MQ queue.

For more information about implementing WebSphere enterprise applications that use message-drive beans, see the following topics:

 

Procedure



Designing an enterprise application to use message-driven beans

Developing an enterprise application to use message-driven beans

Deploying an enterprise application to use message-driven beans against JCA 1.5-compliant resources

Deploying an enterprise application to use EJB 2.0 message-driven beans with listener ports