[rules-users] Drools NOW

Wolfgang Laun wolfgang.laun at gmail.com
Mon Apr 2 04:25:17 EDT 2012


Since your example would indicate that A.aTime is in the future
(relative to current_time) your A isn't a event.

There  is no way you can have a permanently ongoing reevaluation of
facts against rules, which would be the consequence of a truthful fact
representing now in real time.

You might create a fact MyClock with an attribute myTime and set it to a value
that you consider as "current time" for the purpose and context of a
fireAllRules call. You sort of "freeze" Time for one evaluation, and
then you advance it, as convenient for another round.

-W


On 02/04/2012, senyatur <senya.touretski at emc.com> wrote:
> yep
> But as far as I understand (and that's how we are using it) window:time
> defines the time window of the sample events to be inserted in the Drools
> session. What I'm looking for is a way to define rule that will say
> something like this:
> class A{
>      Date aTime;
> }
>
> rule:
> when
> $a:A(aTime > current_time)
> then
> write_log_or_smth_else
>
> And that is what we are unable to find. Hope it is more clear now...
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Compare-with-current-time-in-Drools-tp3875148p3876946.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
>



More information about the rules-users mailing list