I'm testing event processing in Drools, and after some basic tests, I have
some questions about event life cycle management.
According to the documentation, in stream mode, events may be automatically
discarded by the engine when no rule, currently or in the future, applies to
In the following rule set (at the end of my post), the rule named
"Processing new alert event" is expected to be executed when a new
notification event arrives and no previous alert exists. After an elementary
test, the first matching notification produces the expected behavior and
generates the Alert. But if a second matching notification is inserted, the
rule is ignored as expected, since the Alert is already set, but the event
object seems to be put durably in memory. When a 'stop' notification is
inserted, the Alert object is cleared by the rule "Processing stop event
after alert", as expected, but the second 'alert' notification that should
be forgotten is raised from the memory and the first rule is fired again,
creating an undesired second Alert.
I've tried a workaround adding an "opposite rule" to check the processing
an 'alert' notification when there is a current Alert. As at the moment the
notification object is inserted the two rules are candidate in the agenda,
both are executed. I suppose I could try, for example, adding salience
values to make the rules execute in a deterministic order...
As you can see, I've added explicit deletion of the notification objects in
the rules, and all seems to work as needed. But it seems really a bit
cimplicated, and contradictory with the documentation...
What did I miss ?
Thanks for your help.
Here the rule set :
View this message in context:
Sent from the Drools: User forum mailing list archive at Nabble.com