问题
I am trying to use Drools as an rule engine to a synchronizer. The synchronizer does some changes in the system based on some conditions which will be checked using Drools.
fireAllRules() and the matches
Suppose there can be 'matches'** m0, m1, m2 and m3 against my rules. In the image above I have shown what are the matches for two fireAllRules().
When running fireAllRules() first time, 'I get'*** matches m0, m1 and m2.
Then my synchronizer does some changes in the system. On second run of fireAllRules(), I get matches m1, m2 and m3.
What my synchronizer needs at this stage is to identify the following:
- match m0 is removed.
- matches m1 and m2 are repeated. ( old matches)
- match m4 is a new match.
Since Drools is an incremental pattern match-er, I am curious whether there is a way to get these information ( in the bullet points above).
** by 'match' I mean a collection of fact satisfying the 'when' part of the rule. So if I have two object of type Test() in working memory, a simple rule like
when
t : Test()
should have two matches m0 and m1 containing information about two Test() objects.
*** by 'I get' I mean I require Drools to provide me this. I do not know how to get this.
来源:https://stackoverflow.com/questions/45675993/incremental-informations-about-drools-match