<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from rtf -->
<style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<font face="Calibri" size="2"><span style="font-size:11pt;">
<div>I’m having some difficulty getting a rule flow with a stateless session to work. Essentially, it is just executing the first task and then stops. I’m using Drools 5.1.1 and I just built the sample Drools by creating a new Drools Project.</div>
<div><font face="Times New Roman"> </font></div>
<div>My rule flow is simple: Start-RuleGroup1-RuleGroup2-End</div>
<div> </div>
<div>I use the 2 rules from example, putting the “Hello World” in RuleGroup1 and “Goodbye” in RuleGroup2.</div>
<div> </div>
<div>Here’s my code to run it:</div>
<div> </div>
<div><font face="Courier New" size="2" color="#3F7F5F"><span style="font-size:10pt;">// load up the knowledge base</span></font></div>
<div><font face="Courier New" size="2"><span style="font-size:10pt;">KnowledgeBase kbase = <i>readKnowledgeBase</i>();</span></font></div>
<div><font face="Courier New" size="2"><span style="font-size:10pt;">StatelessKnowledgeSession ksession = kbase.newStatelessKnowledgeSession();</span></font></div>
<div><font face="Courier New" size="2"><span style="font-size:10pt;">KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.<i>newFileLogger</i>(ksession, <font color="#2A00FF">"test"</font>);</span></font></div>
<div><font face="Times New Roman" color="#3F7F5F"> </font></div>
<div><font face="Courier New" size="2" color="#3F7F5F"><span style="font-size:10pt;">// start a new process instance</span></font></div>
<div><font face="Courier New" size="2"><span style="font-size:10pt;">Message message = <font color="#7F0055"><b>new</b></font> Message();</span></font></div>
<div><font face="Courier New" size="2"><span style="font-size:10pt;">message.setMessage(<font color="#2A00FF">"Hello World"</font>);</span></font></div>
<div><font face="Courier New" size="2"><span style="font-size:10pt;">message.setStatus(Message.<font color="#0000C0"><i>HELLO</i></font>);</span></font></div>
<div><font face="Times New Roman"> </font></div>
<div><font face="Courier New" size="2"><span style="font-size:10pt;">ArrayList cmds = <font color="#7F0055"><b>new</b></font> ArrayList();</span></font></div>
<div><font face="Courier New" size="2"><span style="font-size:10pt;">ArrayList dataList = <font color="#7F0055"><b>new</b></font> ArrayList();</span></font></div>
<div><font face="Courier New" size="2"><span style="font-size:10pt;">dataList.add(message);</span></font></div>
<div><font face="Courier New" size="2"><span style="font-size:10pt;">cmds.add(CommandFactory.<i>newInsertElements</i>(dataList));</span></font></div>
<div><font face="Times New Roman"> </font></div>
<div><font face="Courier New" size="2"><span style="font-size:10pt;">cmds.add(CommandFactory.<i>newStartProcess</i>(<font color="#2A00FF">"com.sample.ruleflow"</font>));</span></font></div>
<div><font face="Courier New" size="2"><span style="font-size:10pt;">ksession.execute(CommandFactory.<i>newBatchExecution</i>(cmds));</span></font></div>
<div><font face="Courier New" size="2"><span style="font-size:10pt;">logger.close();</span></font></div>
<div><font face="Times New Roman"> </font></div>
<div>When I run the rules, all I get is “Hello World” (no “Goodbye cruel world”). It does work with a Stateful Session using insert, startProcess, and fireAllRules, but this is a test using the rule flows with CommandFactory functionality, something we need
for an application we are developing.</div>
<div><font face="Times New Roman"> </font></div>
</span></font>
</body>
</html>