cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass variables to parallel threads

mstover
Champ in-the-making
Champ in-the-making
When I use a parallelGateway to fork a process to two or more new paths, and if I use async=true so that it truly uses parallel threads, the new threads don't get any of the process variables passed to them.  We're using Camel integration, so we need the camelBody at the very least to flow through to the new threads.  I'm at a loss to understand why the variables don't get passed.  Any help or suggestions on how to make this work?

-Michael
2 REPLIES 2

mstover
Champ in-the-making
Champ in-the-making
Ok, I tried to retrieve the super Execution from the forked parallel Java Delegate, but it failed.  Here was my code:

<code>
    public void execute(DelegateExecution execution) throws Exception {
  String superId = execution.getSuperExecutionId(); 
                Execution parent = execution.getEngineServices().getRuntimeService().createExecutionQuery()
     .executionId(superId).singleResult();
               // superId is NOT NULL
               // parent IS NULL
</code>

So my question is, why do I get an execution id from getSuperExecutionId, but I can't find that execution in the Activiti database using the ExectuionQuery.executionId()?

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi mstover,

So my question is, why do I get an execution id from getSuperExecutionId, but I can't find that execution in the Activiti database using the ExectuionQuery.executionId()?
I would say that execution was not flushed to the DB yet (see org.activiti5.engine.impl.db.DbSqlSession#flush.

Regards
Martin