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

Wolfgang Laun wolfgang.laun at gmail.com
Fri May 6 02:29:36 EDT 2011


For a small number of facts representing future actions a rule with a timer
would provide a generic solution. But timers have static literal durations,
which means that you need to let it fire repeatedly, and test its due-time
in the consequence. (You could devise more efficient but also more elaborate
ways involving more than one checking rule with increasing granularities.)

However, I think that using a simple (Java) timer that inserts an "IsDue"
fact for each timed fact whenever its due-time arrives would also be a good
solution. And if you need to handle a large number, data structures such as
a Binary Heap Queue provide a good way of managing the queue of all future
actions.

-W


On 5 May 2011 23:16, kkelleyjr <karl.kelley.jr at gmail.com> wrote:

> I do not intend on hijacking your thread, but I have a very similar
> question
> that maybe I can get some insight from this thread...
>
> How would one write a rule that generically checks the current time against
> a time in a fact. When the current time and the time in the fact are equal
> the rule fires?
>
> Is this another case where a timer must be used or the calendar? Is there
> some other way to do this?
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/rules-users-Firing-the-rule-at-the-basis-of-time-tp2889494p2905548.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/20110506/5f4eef25/attachment.html 


More information about the rules-users mailing list