Samples > Rule Execution Server Integration > How to Monitor Events in Rule Execution Server

This sample shows you how to generate notifications for actions performed on property elements in the Rule Execution Server Console. For example, if a user adds or modifies a ruleset property, this could trigger an automatic notification to interested parties.

Key Features

Key features include:

Installing the Sample

The sample is installed through the Samples Console.

To install the sample:

  1. In the Samples Console locate the How to Monitor Events in RES sample in: executionserver > monitoringevents.
  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 repack command.
  4. Execute the deploy command. This compiles the application, repackages the EAR, and deploys it to the application server.
  5. Wait for the Java EE application to start before continuing. The server trace displays the following message when the application has started: [EARDeployer] Started J2EE application

Running the Sample

The sample can only be run through the Samples Console.

To run the sample you need to launch the Rule Execution Server Console, then modify the RuleApp or ruleset properties to generate events.

To run the sample:

  1. Execute the deploy.ruleapp target to register the RuleApp.
  2. Open a Web browser and type the following URL to launch the Rule Execution Server Console:
  3. http://localhost:8080/bres
  4. Login using the following details:
  5. Username: bres
    Password: bres
  6. Click the Explorer tab.
  7. Click the monitoringevents RuleApp.
  8. Click Add Property.
  9. Click Add to accept the default property details. The new property appears in the RuleApp View.
  10. Events are logged to an RSS feed file. To view the file, open a new browser and use the following URL:
  11. http://localhost:8080/bres/monitoringevents.rss
    You can also use an RSS Reader to subscribe to the feed.
  12. Return to the Samples Console and execute the reset.rss command to reset the RSS data feed on the server.

Source Files

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

EventsContextListener.java is a Web context listener, it registers a MBean Server listener and listeners on all existing Rule Execution Server MBeans at startup.

EventsFeedServlet.java generates the RSS feed (the URL to subscribe to the feed is http://localhost:8080/bres/monitoringevents.rss).

RESNotificationListener.java is the listener registered on all RuleApps and Rulesets. It adds an event to the RSS feed each time a RuleApp / Ruleset is modified.

ServerNotificationListener.java is the listener registered on the MBean Server. It adds an event to the RSS feed each time a RuleApp / Ruleset is created or removed.

ServerNotificationFilter.java filters the MBean Server events to send only Rule Execution Server events to the ServerNotificationListener.

Utils.java contains static methods used in the sample.

RSSHelper.java is a helper to generate the RSS feed.

Highlights

The principle highlight of this sample is Rule Execution Server management JMX notifications.

Rebuilding the Sample

To rebuild the sample:

  1. Open the Samples Console.
  2. Double-click the deploy target to clean, compile, repack and deploy the sample.

Related Concepts

Rule Execution Server Management Model

Related Tasks

Management Events Monitoring

Related Samples and Tutorials

Tutorial: RuleApp Management