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@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to