[rules-users] accessing session clock from accumulation function or rule body?

Wolfgang Laun wolfgang.laun at gmail.com
Thu May 24 02:13:56 EDT 2012


You can assign the session clock to a global and access it from LHS
conditions and inline accumulate functions.

However, be aware that the value obtained from the session clock
during LHS evaluations is anything between one WM operation and rule
evaluation starts and another WM operation and the activation is
created or recreated. This is particularly true with accumulate, where
insertions and retractions result in partial re-evaluations so that
different evaluations of the "action" or "reverse" part are bound to
obtain different values.

Depending on what you want to achieve, a more consistent notion of
"now" can be obtained by inserting a fact containing the current time
(obtained from the session clock), evaluating whatsoever against this
value, and advancing this "clock" in a predictable way.

-W

On 24/05/2012, radai rosenblatt <radai.rosenblatt at gmail.com> wrote:
> hi.
>
> i'm writing an accumulation function taht needs access to the session clock
> - is this possible from within the accumulation function ?
> if not, is this possible from the rule code (the when section) ? i could
> pass the current time as an argument ...
>
>
> thanks in advance for any assistance.
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/accessing-session-clock-from-accumulation-function-or-rule-body-tp4012348.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