[rules-users] Drools fusion and absence of events

Edson Tirelli ed.tirelli at gmail.com
Wed Oct 28 16:46:07 EDT 2009


  There is a different treatment for infinity: if the wait time is finite,
the engine will delay the rule execution for that amount of time (in STREAM
mode). If there is no temporal constraint or the temporal offset evaluates
to infinity, the engine understand that the event would already have arrived
or will not arrive at all and fires immediately. The reasoning is that makes
no sense to wait forever for something to happen.

   Edson

2009/10/28 richarda <richard.ambridge at gmail.com>

>
> Thanks, it turns out my email post was correct and my code i was testing
> with
> with different..
>
> If I do,
>       $a : MyBean(name=="one");
>      not( MyBean(name=="two", this after [0s,10s] $a))
> which means,  item not received between 0 and 10 seconds
> then it works as expected..
>
> If I do
>         $a : MyBean(name=="one");
>         not( MyBean(name=="two", this after [10s] $a))
> which means, item not received between 10 and infinity seconds
> then I get the false rule trigger when name==other inserted
>
> Need to get my head around that one.
>
>
> Edson Tirelli-4 wrote:
> >
> >     Richard,
> >
> >     It depends on which mode you are running the engine (STREAM or CLOUD)
> > and in case you are using STREAM, which clock are you using.
> >
> >     If you are using CLOUD, Drools assumes all facts/events are
> available,
> > and does not wait to fire the activation.
> >
> >     If you are using STREAM mode, then Drools will delay the firing of
> the
> > rule with a temporal negative pattern for the necessary time (10s in your
> > case) and if after that time the rule is still active, it will fire it.
> > The
> > type of session clock you use, obviously influences the flow of time,
> > where
> > the 10s might be real time, or pseudo time controlled by the application.
> >
> >     The way the rule is written is consistent with the intent you
> > described
> > in your e-mail, so my guess is that you might be using different
> > configurations as described above.
> >
> >     []s
> >     Edson
> >
> > 2009/10/28 Richard Ambridge <Richard.Ambridge at sun.com>
> >
> >> 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
> >>
> >> _______________________________________________
> >> rules-users mailing list
> >> rules-users at lists.jboss.org
> >> https://lists.jboss.org/mailman/listinfo/rules-users
> >>
> >
> >
> >
> > --
> >  Edson Tirelli
> >  JBoss Drools Core Development
> >  JBoss by Red Hat @ www.jboss.com
> >
> > _______________________________________________
> > rules-users mailing list
> > rules-users at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Drools-fusion-and-absence-of-events-tp26093460p26095824.html
> Sent from the drools - user mailing list archive at Nabble.com.
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
 Edson Tirelli
 JBoss Drools Core Development
 JBoss by Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20091028/04b227b0/attachment.html 


More information about the rules-users mailing list