JBoss series forty four: JBPM5 example Gateway

If you select AND in GateWay in jBPM5, it means that multiple tasks are executed in parallel. The ParallelExecute example demonstrates how to execute multiple tasks in parallel in jBPM5. The ParallelExecute process is as follows:

The above figure shows the process of executing multiple tasks in parallel, among which Task1.1, Task1.2, Task1. 3 Parallel execution, Task2.1, Task2.2 parallel execution, Task1.1, Task1.2, Task1.3 behind the Gateway type selection AND, it means that the process continues to execute when all three tasks are completed. All nodes in the figure are Script Tasks, and the same Java code is executed at runtime as follows:

System.out.println (kcontext.getNodeInstance().getNodeName() );

The above code outputs the name of the current node.

  • ParallelExecute process running code: https://github.com/kylinsoong/…/ParallelExecuteStart.java
    < li>ParallelExecute process: https://github.com/kylinsoong/…/parallelExecuteProcess.bpmn

Run org.jbpm.quickstarts.parallel.ParallelExecuteStart to execute ParallelExecute process , ParallelExecuteStart code is as follows:

package org.jbpm.quickstarts.parallel;import org.drools.runtime.StatefulKnowledgeSession; import org.jbpm.quickstarts.QuickStartBase;public class ParallelExecuteStart extends QuickStartBase{ public void test() {StatefulKnowledgeSession ksession = createKnowledgeSession("quickstarts/parallelExecuteProcess.bpmn"); ksession.startProcess("org.jbpm.quickstarts.parallelExecuteProcess"); } public static void main(String[] args) {new ParallelExecuteStart().test(); }}

The output of the ParallelExecute process is as follows:

Execute 3 tasks in parallelTask ​​1.2Task 1.1Task 1.3Execute 2 Tas ksTask 2.1Task 2.2

Leave a Comment

Your email address will not be published.