[rules-users] replace session clock at runtime

Alexander Wolf mail at alexander-wolf.net
Mon Sep 30 09:21:19 EDT 2013


[SOLUTION]

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 database.
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, e.g.  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 helpful)

I also don't get why it is impossible to do the same with the SerializeMarshallingStrategy -> I am pretty sure that the UnMarshaller also internally sets a new clock configuration and it would be a great feature, if this could be exposed to let developers set their own clock as required.

Cheers, Alex

On 25.09.2013, at 06:59, Wolfgang Laun <wolfgang.laun at 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 at 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 continue with
>>> new incoming events...
>>> 
>>> A code snippet would make me very happy ;)
>>> 
>>> - Alex
>>> _______________________________________________
>>> rules-users mailing list
>> 
>>> rules-users at .jboss
>> 
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>> 
>> 
>> 
>> 
>> 
>> --
>> View this message in context:
>> http://drools.46999.n3.nabble.com/rules-users-replace-session-clock-at-runtime-tp4026090p4026112.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
>> 
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20130930/f2a4d303/attachment.bin 


More information about the rules-users mailing list