Writing a plug-in for a ruleset
You can write a plug-in to raise engine events for a specific ruleset.
Before you begin
Rule engine events are raised only for the rulesets that
have the execution trace enabled. To enable the execution trace, set
the property ruleset.trace.enabled to true for
that ruleset in the Rule Execution Server console.
Note: To
receive notifications from tasks that use the sequential mode, you
must enable debugging for this mode.
About this task
Procedure
Write the following code:
public class MyRulesetPlugin extends EventPlugin {
public static final String THIS_CANONICAL_RULESETPATH = "ThisRuleApp/1.0/ThisRuleset/1.0";
public void ruleEngineEventRaised(IlrRuleEngineEvent event) {
if (event.getCanonicalRulesetPath().equals(THIS_CANONICAL_RULESETPATH))
{
thisEngineEventRaised(event);
}
public void thisEngineEventRaised(IlrRuleEngineEvent event) {
// code handling a rule engine event only for this ruleset
[....]
}
}