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";
@Override
public void ruleExecutionCompleted(RuleEvent event) {
if (event.getCanonicalRulesetPath().equals(THIS_CANONICAL_RULESETPATH)) {
thisEngineEventRaised(event);
}
}
private void thisEngineEventRaised(RuleEvent event) {
// code handling a rule event only for this ruleset
[....]
}
}