Samples > Rule Execution Server Integration > How to Use a Message-Driven Rule Bean

The sample shows how to execute a ruleset on the Rule Execution Server using a point-to-point message-driven rule bean. A message-driven bean (MDB) is an enterprise bean that allows Java EE applications to process messages asynchronously.

The sample simulates a pre-trade check operation between a Java client and the message-driven rule bean.

Key Features

Key features include:

Running the Sample

The sample can only be run through the Samples Console.

To run the sample:

  1. Go to the Samples Console and locate the rulemdb > jboss40 sample.
  2. Make sure that the Samples Server is started. For information on how to start and stop the Samples Server, see Stopping and Restarting the Samples Server from the Samples Console.
  3. Execute the deploy command.
  4. Execute the deploy.ruleapp command to register the RuleApp.
  5. Launch the sample using either a Swing based mode or a command line:
  6. Using Swing: Execute the run.ui command to launch the Swing interface. The Swing interface combines the following actions:
    - Connect to the server.
    - Enter an order and send a message for this order.
    - Display the status of this order.
    - Enter another order and send a message for this order.
    - Display the status of this order, and so on.
    - Disconnect from the server.
    The Swing interface displays the results of multiple orders.
    Using the command line: Execute the run command to launch the remote Java client. This mode is only able to execute the pre-trade operation for a single order each time it is executed.

Source Files

The sample is located in <InstallDir>/executionserver/samples/rulemdb.

The Swing user interface source files are located in /executionserver/samples/rulemdb/src/rulemdb/ui.

Highlights

The following figure shows the execution process.

The execution process and the relationship between the JSPs

Rebuilding the Sample

To rebuild the sample through the Samples Console:

  1. In the Samples Console locate the rulemdb/jboss40 sample.
  2. Execute the ear command to Build the classes and package the following files:
  3. The message-driven rule bean Java Archive Resources (JARs).
    The Enterprise Archive Resource (EAR).
  4. Execute the deploy command to deploy the EAR on the Samples Server.

Related Concepts

Rulesets and Ruleset Archives
XML Binding

Related Tasks

Deploying and Exporting RuleApps

Related Samples and Tutorials

How to Use a Rule Session in Java SE