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(a)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(a)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(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users