Thank you for the detailed response and clarifications. I agree that using a
timer for my purpose is not the best idea and am going to try and make use
of event timestamps and then check these values inside the rules.
I understand that by default the timestamp for a given event is read from
the Session Clock and assigned to the event at the time the event is
inserted into the working memory. Is there any way to access these values
from inside the .drl file or do I have to set my own values using the
@timestamp in order to have such access?
As a possible solution I tried setting a timestamp attribute inside an event
at creation time, with a value taken from the session clock.
in .drl file :
declare StateEvent
@role(event)
@timestamp(timestamp)
end
in java code :
SessionClock clock = ksession.getSessionClock();
entryPoint.insert(new StateEvent(motionSensor, clock.getCurrentTime()));
I am doing this in order to have real and pseudo clock functionality for
testing, switching between the two while using almost the same code (calling
advanceTime method for the pseudo clock is basically the only difference).
It serves my purpose but I was wondering if such an implementation could
have unwanted consequences that I am overlooking.
Regards
--
View this message in context:
http://drools.46999.n3.nabble.com/rules-users-Rules-with-variable-timers-...
Sent from the Drools: User forum mailing list archive at
Nabble.com.