Hi all,
So to achieve the desired behaviour I concocted something like this:
1. If got a reading > 30, create tracker-object (of type ZZZTracker) for
this specific profileID and insert it in working memory.
Tracker is just a POJO with some bean fields, e.g. profileID. There is a
check in when-part that a tracker does not exist for this profileID, to
prevent creating many trackers for the same purpose.
when
$mds : ZZZSensorBean(temperature > 30)
then
ZZZTracker $tracker = new ZZZTracker();
$tracker.profileID = $mds.profileID;
end
2. If tracker exists and got three more readings > 30 for this profile
(after tracker insertion), do something intelligent (from the app domain
point of view) and retract tracker from memory.
when
$tracker : ZZZTracker()
$mds01 : ZZZSensorBean( profileID == $tracker.profileID, temperature >
30, this after $tracker)
$mds02 : ZZZBean( profileID == $tracker.profileID, temperature > 30,
this after $mds01)
$mds03 : ZZZBean( profileID == $tracker.profileID, temperature > 30,
this after $mds02)
then
retract($tracker);
...
3. If got a reading < 30 for this profileID and tracker exists, retract
tracker from working memory and so prevent the system from doing something
intelligent.
What do you think, is this solution viable ?
If there are better solutions out there, I would gladly hear of them.
And about using window, in what kind of situations it is intended to be used
?
Because it clearly seems that it isn't an answer to what I need to do.
br Esko
--
View this message in context:
http://drools.46999.n3.nabble.com/Why-this-rule-fires-immediately-tp34304...
Sent from the Drools: User forum mailing list archive at
Nabble.com.