AnsweredAssumed Answered

DelegateExecution variables not set inside a ParallelGateway

Question asked by blezek on Oct 19, 2011
In a JavaDelegate class, the DelegateExecution is passed to the execute method.  Outside of a ParallelGateway, our process variables (accessed through delegateExecution.getVariable()) exist and are what we expect.  However, if the same class (shown below) is used inside a ParallelGateway, the variables are set on the first instance, but not the second.  I believe this is a bug?

A simple example is to use the class below.  If there is no ParallelGateway, the variables are printed without problem.  If there is a ParallelGateway with 1 Echo inside, no problem.  If there is a ParallelGateway with 2 Echo's in parallel, only one gets the variables.

Any help is much appreciated!

package edu.mayo.mi3c.wftest;

import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.Expression;
import org.activiti.engine.delegate.JavaDelegate;

public class Echo implements JavaDelegate {
   public void execute(DelegateExecution arg0) throws Exception {
      System.out.println("Hello from " + this.getClass().getName());
      System.out.println("I have these variables:");
      for (String key : arg0.getVariableNames()) {
         System.out.println(key + " = " + arg0.getVariable(key));
   public static void main(String[] args) {
      ProcessEngineConfiguration config = ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration();
      ProcessEngine engine = config.buildProcessEngine();
      RuntimeService runtime = engine.getRuntimeService();

      DeploymentBuilder builder = engine.getRepositoryService().createDeployment();
      Deployment deployment = builder.deploy();
      String id = deployment.getId();

      HashMap<String, Object> wfvars = new HashMap<String, Object>();
      wfvars.put("PatientID", "1234");
      wfvars.put("BOKey", "10");

      ProcessInstance processInstance = runtime.startProcessInstanceByKey("wftest", wfvars);