[rules-users] Drools fusion and absence of events

Richard Ambridge Richard.Ambridge at Sun.COM
Wed Oct 28 07:52:01 EDT 2009


Hi,
  Trying to get to grips with Fusion and absence of events...

  If I have a Bean that has just a simple variable,  e.g.   class  
MyBean {   private String name;   getter+setter }

  I want to use events to determine when an object with  name=="one"  
is available, and no object with name=="two" appears within 10 seconds..

  So, I write a rule:

  declare MyBean
   @role( event)
end

rule "myrule'
   when
       $a : MyBean(name=="one");
       not( MyBean(name=="two", this after [0s,10s] $a))
   then
       //do something
end


If I inject  an object with Name="one",  and then wait 10seconds, I  
get the 'myrule' fired,  great!

But, if i inject an object with name="one" and then 1second later I  
inject an object with name="other"
the 'myrule' is fired..

Looking at the manual, this seems kind of correct,  the rule says  if  
I have a "one" and not a bean with name=="two"
which I do,  as I have a 'one' and a 'other'

But, how do I write the rule to say,  I have a 'one' and 'two' doesn't  
turn up?

Cheers
Ric




More information about the rules-users mailing list