[rules-users] Rule Flow and Stateless Session
John Peterson
john.peterson.gv3k at statefarm.com
Fri May 27 12:14:24 EDT 2011
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.
My rule flow is simple: Start-RuleGroup1-RuleGroup2-End
I use the 2 rules from example, putting the "Hello World" in RuleGroup1 and "Goodbye" in RuleGroup2.
Here's my code to run it:
// load up the knowledge base
KnowledgeBase kbase = readKnowledgeBase();
StatelessKnowledgeSession ksession = kbase.newStatelessKnowledgeSession();
KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, "test");
// start a new process instance
Message message = new Message();
message.setMessage("Hello World");
message.setStatus(Message.HELLO);
ArrayList cmds = new ArrayList();
ArrayList dataList = new ArrayList();
dataList.add(message);
cmds.add(CommandFactory.newInsertElements(dataList));
cmds.add(CommandFactory.newStartProcess("com.sample.ruleflow"));
ksession.execute(CommandFactory.newBatchExecution(cmds));
logger.close();
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110527/cf4a6c70/attachment.html
More information about the rules-users
mailing list