On 30/09/2013, Edson Tirelli <ed.tirelli(a)gmail.com> wrote:
Regarding the clock, to be honest, I think you found a loophole... :)
the original design does not allow switching out clocks on an existing
session as it is impossible for the engine to guarantee consistency in such
case. Additionally, in my experience, real time clocks are usually not the
best choice for production applications. They require less code, but in the
end, the application has no control over the time flow and can create
several situations that will make it impossible for you to obtain the
If the application just has to follow suit, whatever the time flow
is...? In many apps, it does not have to have "control over the flow
of time". (It would be nice if we had, wouldn't it ;-) )
My suggestion is always to use a pseudo clock and have your application
control it based on your desired behaviour. This can be as simple as a
thread syncing the clock with the machine clock at predefined intervals, or
based on a clock heartbeat event, or based on the streams of events, etc.
So, what's the feature of setting the event's time stamp according to
the system's clock meant to achieve if you recommend using pseudo
clocks all over?
Not that I entirely disagree with you. A well-tuned pseudo-clock may
avoid many issues, although there are several issues, e.g., timers,
and what is the relationship with the way rules are fired...
Thanks for pointing out the docs errors. We will update them for the
next release (6.0.0). Also, if you can submit a PR with the update, always
happy to apply.
On Mon, Sep 30, 2013 at 9:21 AM, Alexander Wolf
> I found a "solution/workaround" to this problem:
> I create the session with
> JPAKnowledgeService.newStatefulKnowledgeSession() and pseudo clock in
> configuration, feed in my old events -> and store the session it a
> When retrieving the session, I can set realtime clock in the
> configuration with JPAKnowledgeService.loadStatefulKnowledgeSession().
> As I am not really interested in storing the sessions, I use an in-memory
> db like in the documentation (3.3.10. Persistence and Transactions)
> @Project Team:
> The documentation (Chapter 3.3.10 / Drools 5.5.0) is really outdated,
> the package references in persistence.xml are not correct any more .
> Also it seems to be a full example, but missing location of files (where
> to put persistence.xml) and information about general configuration of
> hibernate and bitronix. (I can see why you omitted it, but it would be
> I also don't get why it is impossible to do the same with the
> SerializeMarshallingStrategy -> I am pretty sure that the UnMarshaller
> internally sets a new clock configuration and it would be a great
> if this could be exposed to let developers set their own clock as
> Cheers, Alex
> On 25.09.2013, at 06:59, Wolfgang Laun <wolfgang.laun(a)gmail.com> wrote:
> > Setting the clock is a session configuration option, which means that
> > it has to be set at session instantiation time.
> > You might try to continue to use the pseudo-clock until you have
> > finished
> > the replay and mimick the realtime clock with it, although it might
> > need
> > some experimenting to learn when and how to advance the pseudo-clock:
> > before and/or after insertions, every n ms,...
> > -W
> > On 24/09/2013, amarok <mail(a)alexander-wolf.net> wrote:
> >> I am still stuck with this. Is there any way to replay events into a
> >> session
> >> and then getting into realtime mode?
> >> amarok wrote
> >>> Drools 5.5
> >>> Hey guys,
> >>> Is it possible to replace the session clock of an existing stateful
> >>> knowledge session (STREAM mode) while it is running or at least by
> >>> pausing
> >>> and restarting it?
> >>> I need to feed old events into the session to restore a certain
> >>> session
> >>> state before switching the sessions to "realtime" mode and
> >>> new incoming events...
> >>> A code snippet would make me very happy ;)
> >>> - Alex
> >>> _______________________________________________
> >>> rules-users mailing list
> >>> rules-users@.jboss
> >>> https://lists.jboss.org/mailman/listinfo/rules-users
> >> --
> >> View this message in context:
> >> Sent from the Drools: User forum mailing list archive at Nabble.com
> >> _______________________________________________
> >> rules-users mailing list
> >> rules-users(a)lists.jboss.org
> >> https://lists.jboss.org/mailman/listinfo/rules-users
> > _______________________________________________
> > rules-users mailing list
> > rules-users(a)lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> rules-users mailing list
Principal Software Engineer
Red Hat Business Systems and Intelligence Group