[rules-users] Question about backing up a flow

Mauricio Salatino salaboy at gmail.com
Mon Oct 19 12:24:27 EDT 2009


You don't need to demarcate the user transactions there.. Drools Flow will
be in charge of that.

you only need to keep the session id in order to be able to restore it when
you need it..


2009/10/19 Nair, Mahesh <Mahesh.Nair at qwest.com>

>  Hello everyone,
>
> I'm new to drools & I'm trying my hand at creating a rule-flow in which
> I can back a couple of steps &
> the KnowledgeSession is restored to the same state it was in earlier. I'm
> using Drools 5.1.0 M1 & Eclipse 3.5.
>
> I have a rule-flow with the following nodes:
> A->B->C
> where A would be a node asking for an input (our fact), B would be a Rule
> Task that would apply certain rules on our fact &
> at C, I may decide that I need to back up to node A. Both A & C are custom
> work items.
>
> I've managed to rollback the transaction (I borrowed a lot of code from the
> test classes in the source, thanks a ton for them).
> But I just can't get my process to start again.
>
> I'll paste a couple of lines of code from my test class below:
> .....
> ProcessInstance pi = ksession.startProcess("sampleflow");
> ksession.fireAllRules();
>   ut = (UserTransaction) *new* InitialContext().lookup(
> "java:comp/UserTransaction" );
> ut.begin();*//Is beginning the transaction boundary here correct?*
> .....
> *//Now I roll back the transaction depending on the input at node C*
> ut.rollback();
> *.....*
> *//And recreate the knowledge session*
> ksession = JPAKnowledgeService.loadStatefulKnowledgeSession(id, kbase, *
> null*, env);
>
> I expected the session to restart the process from node A once it was
> recreated. Am I going in the right direction?
> Or is my basic understanding of how session persistence works in Drools
> Flow flawed?
>
> I'd really appreciate a push in the right direction.
>
> Thanks in advance,
> Mahesh.
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
- http://salaboy.wordpress.com
- http://www.jbug.com.ar
- Salatino "Salaboy" Mauricio -
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20091019/3f2a2128/attachment.html 


More information about the rules-users mailing list