javajbpmkie-wb

How to exchange variables with reusable sub-process in JBPM 6.4.0?


I wanted to improve the structure of my jbpm process and therefore tried to encapsulate some stuff in a reusable subprocess. Following the instructions in the documentation, I first created a simple test-process to validate its behavior.

To achieve this, I defined the following:

A (parent-)process with 2 variables "sub_in" and "sub_out" of type String. A second (child-)process with 2 variables "in_sub" and "out_sub" of type String.

The parent process contains a Script Task, which sets "sub_in" to "input", a Sub-process Task (calling the child-process), and a second Script Task, which outputs the value of "sub_out".

The child-process contains a single Script Task, which outputs the value of "in_sub" and sets "out_sub" to "output". Additionally I defined an I/O-mapping of (Name: "in_sub", Data Type: "String", Source "sub_in") and (Name "out_sub", Data Type: "String", Target: "sub_out").

Surprisingly, both scripts output null as value of the corresponding variable. Is this feature broken in version 6.4.0? Am I missing something? I saw a similar question on Google groups, but without any reactions.

FYI: I am using a the Kie-Workbench and KIE Execution server (both Version 6.4.0.Final on two JBoss EAP 6.4 instances) to design and run the processes.

Any suggestions are appreciated.


Solution

  • I did this on jBPM 6.5 beta 1 and it worked as expected. In the script tasks make sure you set the variables like

    kcontext.setVariable("sub_in", "input");
    

    It could be broken in 6.4 - I know multi-instance subprocesses are broken in that load, fixed in 6.5 beta 1 (see https://issues.jboss.org/browse/JBPM-5143)