So would I simply call fireUntilHalt() in a loop in a separate thread? Is
Halt called by the engine when all rules have fired, or so I need to also
call that explicitly?
Thanks,
Chris
_____
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Greg Barton
Sent: Friday, September 25, 2009 10:30 AM
To: Rules Users List
Subject: Re: [rules-users] Event streams
Yes to both. However to the first part (rules firing "automatically") you
need to use fireUntilHalt() instead of fireAllRules(). fireUntilHalt blocks
(until halt is called) so you need to invoke it in a separate Thread. Then
from another thread you can insert events into the entry points. For the
second item (long lived event) you must use an @expires tag in your object
declaration and be running in STREAM mode.
_____
From: Chris Richmond <crichmond(a)referentia.com>
To: Rules Users List <rules-users(a)lists.jboss.org>
Sent: Friday, September 25, 2009 3:17:52 PM
Subject: [rules-users] Event streams
It is my understanding that an event will be detected as soon as it is
inserted into a stream.meaning that I don't have to explicitly call
fireRules in order to evaluate events, but them will be evaluated as soon as
I insert them into a stream, so a rule like the one below would fire as soon
as I perform datastream.insert(myDataStreamObject) without having to
explicitly fire rules? Is that behavior correct/intended?
Declare MyDataStreamObject
@role(event)
End
//rule "detect a stream data object"
When
MyDataStreamObject() from entry point "DATA"
Then
System.err.println("data object inserted");
end
Also, could I generate another event(long lived.say it lives 1 minute) so
that if the above event detector fired and some condition was met, I could
have it fire some event within the rule engine? Something like the
following:
//rule "detect a stream data object"
When
MyDataStreamObject($val: fieldValue < 20) from entry point
"DATA"
Then
//I want to raise an event purely from this rule that will live
for one minute or so, that I can use to further refine this rule, to make
sure this rule makes
//sure that the MyDataStreamObject event "NOT INCLUDED" within
the generated longer lived event lifetime. Efffectively preventing me from
firing this if one of my
//generated events is still living
end
Thanks,
Chris