Update:
the sample project may have the modifier "final" on the main method for
some reason...I have no idea how or why that got on there, but will
prevent eclipse from running it.
Also, I believe i found the problem:
rule "Wait for follup config"
lock-on-active
when
$dr: DataReading(reading > 10.0) from entry-point "My Stream"
not($de: ConfigEvent(this after[0s,10s] $dr))
then
System.err.println("Action");
end
Should read:
rule "Wait for follup config"
lock-on-active
when
$dr: DataReading(reading > 10.0) from entry-point "My Stream"
not(ConfigEvent(this after[0s,10s] $dr) from entry-point "My Stream")
then
System.err.println("Action");
end
where the temporal matching predicate must also state the stream I was
injecting events to. This seems to work ok, but I would still
appreciate feedback.
Thanks,
Chris
On 7/22/2011 1:47 AM, Chris Richmond wrote:
I have attached my program project with my main FusionMain.java and
two small classes and my rule file Sample.drl.
It's a zip file i have modified to be .piz for mail server reasons.
In the Main I set up and run as STREAM mode session and execute on a
background thread .fireUntilHalt().
Then I inject two objects(DataReading and ConfigEvent)
The Sample.drl rule has the rules:
declare DataReading
@role( event )
end
declare ConfigEvent
@role( event )
end
rule "Detect high data reading"
when
$dr: DataReading(reading > 10.0) from entry-point "My Stream"
then
System.err.println("Data reading > 10");
end
rule "Wait for follup config"
lock-on-active
when
$dr: DataReading(reading > 10.0) from entry-point "My Stream"
not($de: ConfigEvent(this after[0s,10s] $dr))
then
System.err.println("Action");
end
rule "Detect config event"
when
$ce: ConfigEvent() from entry-point "My Stream"
then
System.err.println("Config Event");
end
What I expect is that I would see the DataReading rule fire right
away(it does)
then 5 seconds later when I insert the ConfigEvent I would see it's
rule fire(it does)
But the "Wait for follup config" rule fires no matter what.
To me, that rule should wait and make sure no ConfigEvent object was
inserted within 10 seconds after the DataReading object, but no matter
what that rule fires after 10 seconds. How can I make my inserted
ConfigEvent(inserted within the 10 seconds) satisfy that condition so
it cancels that rule from firing? I am using the latest download from
the site (5.2.0 final) binaries.
Does Fusion in fact work or am I doing something wrong? The zip file
has the entire runnable program and project(have to modify lib
references to point to correct Drools 5.2 binaries).
If the zip file does not come through I will attach the files
individually next.
Thanks,
Chris