callActivity element and activiti:async="true" in main process

cancel
Showing results for 
Search instead for 
Did you mean: 
sidzej
Member II

callActivity element and activiti:async="true" in main process

Hi,

What I want to do: rearange big process and move group of elements into separate bpmn diagrams. After creation of small diagrams use them in big process by calling callActiviti element.

Version: 5.20.0

Current behavior: there are 5 instances that process stuff from a single database. Because of using the activiti:asnyc="true" in bpmn diagrams, in each job obtaining "tick" we process in one "tick" at most one job from this process and the process is "locked" for other instances.

Question: If the following element will be used in "main" diagram:

<callActivity id="X" name="Y" calledElement="subprocess-diagram">
  <extensionElements>
    <activiti:in source="variable" target="variable" />
  </extensionElements>
</callActivity>

will the behavior of processing at most one element at a time will still work? Will the job acquisition notice that sub-process from callActiviti is part of the main-process and prevent from processing in same "tick" more than one element? If not, do you have any advice how to keep this behavior after refactoring into sub-diagrams?

2 Replies
salaboy
Senior Member

Re: callActivity element and activiti:async="true" in main process

Hi there, 

Not sure to understand what is the motivation behind of using "one tick" to process stuff. If you need to do that, just don't use async, async is for trying to do things in parallel by different threads. If you have a requirement to just do one thing at the time, just don't use async. 

Does that make sense?

sidzej
Member II

Re: callActivity element and activiti:async="true" in main process

Thanks for answer, Mauricio.

I will explain more what is the concern for us and why we want a specific behavior:

1. When calling CallActivity the efect is that the engine creates a separate process.

2. In the "upper process" we have a non sequential "multi-instance-loop" that may contain multiple elements and we want process those elments in "pseudo-parallel" so one of them will not block the other while waiting for events. At the same time we don't want to process two jobs from the "upper process" at the same time since that may cause conflicts while writting data to external systems and accessing "upper process" variables.

So the question is: will the "upper process" notice that at it's lower level CallActiviti is running and will it maintain the "one job per tick for process" behavior? Or will both "upper process" and new process from callActiviti process their jobs at the same time?

If what we want to do can be done by setting parameters at bpmn level we would gladly hear how to set everything to achieve the desired behavior.