[jboss-user] [jBPM] - Difficulties Invoking Rule Task

Tobias Wittur do-not-reply at jboss.com
Sun Sep 18 19:47:45 EDT 2011

Tobias Wittur [http://community.jboss.org/people/tob1as] created the discussion

"Difficulties Invoking Rule Task"

To view the discussion, visit: http://community.jboss.org/message/627082#627082


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/showImage/2-627082-16997/Capture5.PNG  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/showImage/2-627082-16998/Capture7.PNG  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,


Reply to this message by going to Community

Start a new discussion in jBPM at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110918/4d13be89/attachment.html 

More information about the jboss-user mailing list