You don&#39;t need to demarcate the user transactions there.. Drools Flow will be in charge of that.<br><br>you only need to keep the session id in order to be able to restore it when you need it..<br><br><br><div class="gmail_quote">
2009/10/19 Nair, Mahesh <span dir="ltr">&lt;<a href="mailto:Mahesh.Nair@qwest.com">Mahesh.Nair@qwest.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">




<div>
<div>
<div><span><font face="Arial" size="2">Hello 
everyone,</font></span></div>
<div><span><font face="Arial" size="2"></font></span> </div>
<div><span><font face="Arial" size="2">I&#39;m new to drools 
&amp; I&#39;m trying my hand at creating a rule-flow in which I can back a 
couple of steps &amp; </font></span></div>
<div><span><font face="Arial" size="2">the 
KnowledgeSession is restored to the same state it was in earlier. I&#39;m 
using Drools 5.1.0 M1 &amp; Eclipse 3.5.</font></span></div>
<div><span><font face="Arial" size="2"></font></span> </div>
<div><span><font face="Arial" size="2">I have a rule-flow 
with the following nodes:</font></span></div>
<div><span><font face="Arial" size="2">A-&gt;B-&gt;C</font></span></div>
<div><span><font face="Arial" size="2">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 &amp; </font></span></div>
<div><span><font face="Arial" size="2">at C, I may decide 
that I need to back up to node A. Both A &amp; C are custom work 
items.</font></span></div>
<div><span><font face="Arial" size="2"></font></span> </div>
<div><span><font face="Arial" size="2">I&#39;ve managed to 
rollback the transaction (I borrowed a lot of code from the test classes in the 
source, thanks a ton for them).</font></span></div>
<div><span><font face="Arial" size="2">But I just 
can&#39;t get my process to start again.</font></span></div>
<div><span><font face="Arial" size="2"></font></span> </div>
<div><span><font face="Arial" size="2">I&#39;ll paste a couple 
of lines of code from my test class below:</font></span></div>
<div><span><font face="Arial" size="2">.....</font></span></div><span>
<div align="left"><font size="2"><font face="Arial">ProcessInstance pi = 
ksession.startProcess(</font><font color="#2a00ff"><font color="#2a00ff" face="Arial">&quot;sampleflow&quot;</font></font><font face="Arial">);</font></font></div>
<div align="left"><font face="Arial" size="2">ksession.fireAllRules();</font></div></span>
<div><span><font face="Arial" size="2">  </font>
<div align="left"><font face="Arial"><font size="2">ut = (UserTransaction) <b><font color="#7f0055"><font color="#7f0055">new</font></font></b></font></font><font face="Arial" size="2"> InitialContext().lookup( <font color="#2a00ff"><font color="#2a00ff">&quot;java:comp/UserTransaction&quot;</font></font> );</font></div>

<div align="left"><font face="Arial"><font size="2">ut.begin();<span><i>//Is beginning the transaction boundary here 
correct?</i></span></font></font></div><font face="Arial" size="2">.....</font></span></div>
<div><span><i><font face="Arial" size="2">//Now I roll 
back the transaction depending on the input at node C</font></i></span></div>
<div><span><font face="Arial" size="2">ut.rollback();</font></span></div>
<div><span><i><font face="Arial" size="2">.....</font></i></span></div>
<div><span><i><font face="Arial" size="2">//And recreate 
the knowledge session</font></i></span></div>
<div><font size="2"><font face="Arial">ksession = 
JPAKnowledgeService.loadStatefulKnowledgeSession(id, kbase, </font><b><font color="#7f0055"><font color="#7f0055"><font face="Arial">null</font></font></font></b></font><font face="Arial" size="2">, 
env);</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><span><font face="Arial" size="2">I expected the 
session to restart the process from node A once it was recreated. Am I going in 
the right direction?</font></span></div>
<div><span><font face="Arial" size="2">Or is 
my basic understanding of how session persistence works in Drools Flow 
flawed?</font></span></div>
<div><span><font face="Arial" size="2"></font></span> </div>
<div><span></span><span><font face="Arial" size="2">I&#39;d really appreciate a push in the right 
direction.</font></span></div>
<div><span><font face="Arial" size="2"></font></span> </div>
<div><span><font face="Arial" size="2">Thanks in 
advance,</font></span></div>
<div><span><font face="Arial"><font size="2"><span>Mahesh</span>.</font></font></span></div></div></div>
<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br> - <a href="http://salaboy.wordpress.com">http://salaboy.wordpress.com</a><br> - <a href="http://www.jbug.com.ar">http://www.jbug.com.ar</a><br> - Salatino &quot;Salaboy&quot; Mauricio -<br>