Events monitoring sample details
You use the Samples Console and the Rule Execution Server console to run this sample.
Running this sample
You launch the Rule Execution Server console, and then modify RuleApp or ruleset properties to generate events.
To run this sample:
- Run the deploy.ruleapp command to register the RuleApp.
- Open a web browser and type the following URL to launch the Rule Execution Server console: http://localhost:<PORT>/res.
- Log on to the Rule Execution Server console by using
the following credentials:
- User name: resAdmin
- Password: resAdmin
- Click the Explorer tab.
- Click the monitoringevents RuleApp.
- Click Add Property.
- Click Add to accept the default property details. The new property opens in the RuleApp View.
- Events are logged to an RSS feed file. To view the file, open a new browser and use the
following URL:
http://localhost:<PORT>/res/monitoringevents.rss.
You can also use an RSS Reader to subscribe to the feed.
- Return to the Samples Commands view and run the reset.rss command to reset the RSS data feed on the server.
Note: If your browser does not recognize the RSS format, a tree is shown as XML.
Rebuilding this sample
To rebuild the sample:
- Make sure that you are in the Samples Console perspective.
- Double-click the repack command to clean, build, and repack the sample.
- Double-click the deploy command to deploy the sample to the application server.
To clean up the sample artifacts:
- Make sure that you are in the Samples Console perspective.
- Double-click the cleanup command to remove the monitoringevents RuleApp and restore the original management console.
How this sample works
The sample uses Rule Execution Server console and Java™ Management Extensions (JMX) to monitor events.
Source files
The sample is located in
<InstallDir>/executionserver/samples/monitoringevents, and contains the
following source files:
- EventsContextListener.java: A web context listener that 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:<PORT>/res/monitoringevents.rss.
- RESNotificationListener.java: A listener that adds an event to the RSS feed each time a RuleApp or ruleset is modified. It is registered on all RuleApps and rulesets.
- ServerNotificationListener.java: A listener that adds an event to the RSS feed each time a RuleApp / Ruleset is created or removed. It is registered on the MBean Server.
- ServerNotificationFilter.java: Filters the MBean Server events to send only Rule Execution Server events to the ServerNotificationListener instance.
- Utils.java: Contains static methods that are used in the sample.
- RSSHelper.java: The helper that is used to generate the RSS feed.