Inline.
# If two WorkerInWorkEvents exist for a worker, there must be a WorkerOutOfWorkEvent between them
rule "ERROR: Consecutive WorkerInWorkEvents"
when
$w1 : WorkerInWorkEvent( $workerId : workerId )
$w2 : WorkerInWorkEvent( workerId == $workerId, this after $w1 )
not WorkerOutOfWorkEvent( workerId == $workerId, this after $w1, this before $w2 )
then
errors.add("Two WorkerInWorkEvents without a WorkerOutOfWorkEvent in between (" + $w2 + ")");
retract( $w2 );
end
I could see via the log that this file was activating, however it was never firing. The retraction of $w2 should have cancelled other rules' activations, but it wasn't doing so because this rule was never firing. I just discovered a thread (http://drools.46999.n3.nabble.com/Drools-fusion-and-absence-of-events-td51125.html) which finally explained to me the reason why: I was running in STREAM mode, and the engine was waiting to see if a WorkerOutOfWorkEvent timestamped between the two WorkerInWorkEvents was going to show up. When I switched to CLOUD mode, the rule fired as expected and my other activations were cancelled as I expected.
Now, my new question is: Since I have not specified any intervals, how long will the engine wait for the WorkerOutOfWorkEvent to show up? Forever?
Thanks in advance for any light you can shed on this.
Mike
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users