-
Notifications
You must be signed in to change notification settings - Fork 1.1k
defining rules listener
Mahmoud Ben Hassine edited this page May 17, 2017
·
6 revisions
You can listen to rule execution events through the RuleListener API:
public interface RuleListener {
/**
* Triggered before the evaluation of a rule.
*/
boolean beforeEvaluate(Rule rule);
/**
* Triggered before a rule is executed.
*/
void beforeExecute(Rule rule);
/**
* Triggered after a rule is executed successfully.
*/
void onSuccess(Rule rule);
/**
* Triggered after a rule is executed with error.
*/
void onFailure(Rule rule, Exception exception);
}You can implement this interface to provide custom behavior to execute before/after each rule. To register your listener, use the following snippet:
RulesEngine rulesEngine = aNewRulesEngine()
.withRuleListener(myRuleListener)
.build();You can register as many listeners as you want, they will be executed in their registration order.
Easy Rules is created by Mahmoud Ben Hassine with the help of some awesome contributors
-
Introduction
-
User guide
-
Tutorials
-
Get involved