Message-Driven Bean Sample

This sample shows how message-driven beans can be used by a client application to invoke the methods of multiple session or entity beans in an asynchronous manner. Specifically, a page flow sends multiple JMS messages to various message-driven beans, which in turn create new entity bean instances or remove entity beans, a pattern known as message façade. In addition, the page flow interacts with a session bean to invoke read operations on the same entity bean, a pattern known as session façade. The combination of message façade for write operations and session façade for read operations is a common design approach in full-fledged EJB applications with asynchrony requirements.

The following EJBs are used in this sample:

In addition, the following components are used in this sample:

Note. This sample demonstrates the session and message façade pattern, and the use of JMS messages. For more detailed information on these topics, see your favorite documentation on EJB design patterns and JMS messaging.

Concepts Demonstrated by this Sample

Location of Sample Files

The EJBs are located in the messageDriven folder of the EJBs project in the SamplesApp sample application. In the file system the location is:

BEA_HOME\weblogic81\samples\workshop\SamplesApp\EJBs\messageDriven

The page flow files that you run as a client application, the various controls used by the page flow, are located in the messageDriven folder of the EJBs_ClientApps project in the SamplesApp sample application. In the file system of the JPF controller file is:

BEA_HOME\weblogic81\samples\workshop\SamplesApp\EJBs_ClientApps\messageDriven\Controller.jpf

To Run the Sample

  1. Start WebLogic Server in the appropriate domain.
  1. Launch the page flow controller either by opening it in WebLogic Workshop and selecting the Start operation or by entering http://localhost:7001/EJBs_ClientApps/messageDriven\Controller.jpf in the address bar of your browser. If WebLogic Server is running in the appropriate domain on this machine, you may click here to run the sample.

Related Topics

Value Object Sample

Getting Started with Message-Driven Beans

@ejbgen:message-driven Annotation

JMS Control

EJB Control

Building Custom Java Controls