[rules-users] Firing the rule at the basis of time

Wolfgang Laun wolfgang.laun at gmail.com
Sun May 8 04:45:58 EDT 2011


The session clock is available from the StatefulKnowledgeSession:

   SessionClock clock = kSession.getSessionClock();
   long ctInMillis = clock.getCurrentTime();

Also, in RHS code, you can do

   kcontext.getKnowledgeRuntime().getSessionClock();

-W




On 6 May 2011 21:07, kkelleyjr <karl.kelley.jr at gmail.com> wrote:

> Thanks for the Reply,
>
> What you are saying makes sense... So, for my purpose of learning timers I
> would like to take a look at this further... The issues I am having is
> finding a reference to the real time session clock... So how can I get a
> reference to the session clock so that I can set time stamp properties
> within my facts...
>
> Also, I should point out that I am using the drools server so the
> configuration would be through spring in the knowledge-services.xml file...
>
> My thought is that I would set a global in my rules.drl file to the session
> clock instance... But I can not find the session clock for the real time
> session clock... Also, how would the spring configuration look...
>
> Use Case:
>
> Load some facts with a message in them, the last run time stamp is set to
> the current time, the next run time is set to some time in the future...
>
> Timer rule will check the current session time to the next run time and
> fire
> when appropriate...
>
> Then the facts last run time is updated as well as the next run time...
>
> Sounds simple... Just need to know how to get a ref to the session clock so
> I can do the checking and updating...
>
> Thanks for any advice...
>
>
> Any advice is welcome...
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/rules-users-Firing-the-rule-at-the-basis-of-time-tp2889494p2909476.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110508/340c91b7/attachment.html 


More information about the rules-users mailing list