[rules-users] Fusion, Insert Events with timestamp in the past.

Wolfgang Laun wolfgang.laun at gmail.com
Wed Jun 4 11:09:13 EDT 2014


On 04/06/2014, SebastianStehle <mail2stehle at gmail.com> wrote:
> We made another test with the pseudclock where we advanced the time after
> each measurement.
>
> Lets say we have the two measurements, the first at 10am and the second at
> 11am. Based on the rule before, you would expect that the rule fires at
> 10:10am because no other event is inserted. But what happens was that the
> rule is activated at 11am, because the clock has not been advanced in the
> meantime. This makes totally sense for me, so I thought you might need
> another thread or so.

Absolutely.

>
> If you implement it like this (pseudo-code), it works fine:
>
> session.insert(first);
> clock.advanceTime(first.getTime());
>
> while (time < second.getTime()) {
>     clock.advanceTime(100);
>     time.add(100ms);
> }
>
> session.insert(second);
> clock.advanceTime(second.getTime());

Right, this should take care of the timers.

>
> What makes our scenario very complicated is that we mix realtime and
> pseudo-time a little bit. For example we have timers that trigger at
> midnight or so (in realtime) and we have measurmenets with a delay of some
> seconds, where we need a pseudoclock. I have no real idea how this can be
> realized, but I still wonder, what @timestamp is for, if it cannot combined
> with the normal clock.

The time of measurements is one progress of time, and when you need a
midnight event, you should ask one of the measurement providers.  If
midnight is a more or less arbitrary point in that progress of time,
you can use your local clock.

There is an European norm that deals with the reliability of networks.
If you have to expect delays, you may have to detect them, and decide
what counter-action to employ.

IIRC, at the start if this thread there was the issue of updating
rules. There is the option of changing the rules "on the fly", without
creating a new session. And there may be a different approach,
deriving "state" from a sequence of events, rather than trying to
keep the sequence with its timestamps - but this depends on what the
events signify.

-W







>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Fusion-Insert-Events-with-timestamp-in-the-past-tp4029843p4029858.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