Search code examples
drools

Drools - error with “after” operator


Recently, I has been working with Drools component. I found a very interesting thing. The problem is that drool engine do not fire conditions which use “after” operator. This condition does not always work. Error case requires that external events come to the system immediately. It’s mean that if to set timer for 10 milliseconds between coming events everything works fine. If events comes into the system continuously (without timer, see my code below) after some time rules not fire.

For more information please red my blog: http://i-liger.com/article/problem-drools

I will be very grateful for any help or suggestion. Thank you in advance!!


Solution

  • The after evaluator correlates two events and matches when the temporal distance from the current event to the event being correlated belongs to the distance range declared for the operator.

    The temporal distance interval for the after operator is optional: If two values are defined (like in the example below), the interval starts on the first value and finishes on the second. If only one value is defined, the interval starts on the value and finishes on the positive infinity. If no value is defined, it is assumed that the initial value is 1ms and the final value is the positive infinity.

    solution: change "after" --> "after[0ms]"