[rules-users] Event consuming policy

Khalil Hafsi hafsi at fzi.de
Mon Dec 14 15:25:03 EST 2009


Hi Guys,

I was working lately with drools fusion, we wanted to know what event
consumption policy was implemented.
We made the following simple rule :

rule a
   
    when
        $c1 : Event(symbol == 1 , $l1 :load) from entry-point "mainS"
         and
        $c2 : Event(this after $c1,symbol == 2,$l2 :load) from
entry-point "mainS"
       
    then
        System.out.println("event1 "+$l1+" event2 "+$l2);
       
end

The event class has just symbol : int and load : int , load is used to
differentiate between different events that have the same symbol.

and then we declared the following events into the stream using the
constructor Event(symbol,load): with mainS being a WorkingMemoryEntrypoint

            mainS.insert(new Event(1,10.0));   
            mainS.insert((new Event(1,20.0)));   
            mainS.insert((new Event(1,30.0)));           
            mainS.insert(new Event(2,80.0));
            mainS.insert(new Event(2,90.0));


We have the following output :

          event1 30.0 event2 90.0
          event1 20.0 event2 90.0
          event1 10.0 event2 90.0
          event1 10.0 event2 80.0

So what is exactly the consumption policy used in DROOLS ? It seems that
is unrestricted for event 90.0 and chronological for event 80 .

We have tested different situations and order of events and we always
came to the conclusion that for the first $c2 the policy is
chronological and for all the other $c2's it is unrestricted.

Thank you for you time.
Khalil




More information about the rules-users mailing list