Hi,
I was trying to invoke a rule task within my process.
First, I took the example that was part of the unit test examples:
http://community.jboss.org/servlet/JiveServlet/downloadImage/2-627082-16997/277-66/Capture5.PNG
The execution works fine.
I then added a human task node and a script task:
http://community.jboss.org/servlet/JiveServlet/downloadImage/2-627082-16998/450-46/Capture7.PNG
Here, the script task prints a hello world, but then the process instance stops at the rule task.
Does anyone know, why it is not running into the rule task? As I estimate, the rule task node has to be active at the time the fireAllRules function is executed ?! But do I have to manually fire that event everytime a rule has to be executed in a process?
The java looks as follows.
System.out.println("Loading process BPMN2-RuleTask.bpmn2");
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource("junit/BPMN2-RuleTask.bpmn2"), ResourceType.BPMN2);
kbuilder.add(ResourceFactory.newClassPathResource("junit/BPMN2-RuleTask.drl"), ResourceType.DRL);
KnowledgeBase kbase = kbuilder.newKnowledgeBase();
StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
ksession.getWorkItemManager().registerWorkItemHandler(
"Human Task",
new WSHumanTaskHandler()
);
List<String> list = new ArrayList<String>();
ksession.setGlobal("list", list);
ProcessInstance processInstance = ksession.startProcess("RuleTask");
ksession.fireAllRules();
Best regards,
Tobias