cancel
Showing results for 
Search instead for 
Did you mean: 

Activiti parallel execution of subProcesses

semenchikus
Champ on-the-rise
Champ on-the-rise

I'm trying to implement the following workflow:

there are 3 separate subProcesses (dbTaskPrescoringProcess, level1PrescoringProcess and level2PrescoringProcess) that should be executed in concurrently. So I've added the following properties to each process: activiti:async="true" activiti:exclusive="false"

A service task ("Level2 Prescore") in level2PrescoringProcess should be executed by one of the following events:

- Timer event

- Signal event (throws in level1PrescoringProcess).

So Event-Based Gateway is used.

Of course I've added parallelGateways to the input and output to these subProcesses.

In the result I have two problems:

1. Level2 Prescore service task of level2PrescoringProcess starts with significant delay (more than timer event value, tried even PT1S).

2. dbTaskPrescoringProcess executes twice. Sometimes even after the parent process has been finished ("Print result" service task has been completed).

I am beginner in Activiti so please advice what I did wrong?

Thank you,

Simon

1 ACCEPTED ANSWER

daisuke-yoshimo
Star Collaborator
Star Collaborator

Well, it is not a very good method, but it may be solved by raising the revision of the exclusive control target entity.

For example,in DbTaskPrescoringDelegate.class, you should add the following code.
But, if you use the same variable between parallel executions, you should raise the VariableInstanceEntity and HistoricVariableInstanceEntity too.

ExecutionEntity execution = Context.getCommandContext().getDbSqlSession().findInCache(ExecutionEntity.class, delegateExecution.getId());
ExecutionEntity rootExecution = execution.getParent().getParent();

rootExecution.setRevision(rootExecution.getRevisionNext());
Context.getCommandContext().getDbSqlSession().update(rootExecution);

View answer in original post

9 REPLIES 9