cancel
Showing results for 
Search instead for 
Did you mean: 

call activiti vs subprocess

monika_b
Champ in-the-making
Champ in-the-making
fHi, I want to know the usecase when we should use call activiti vs subprocess.

I understands few reasons, like in subprocess we have hierarchical modeling and boundary events.
I am little not clear about process execution creation in both.

Question: What is the advantage of creation of a separate process execution in 'Call Activiti'? And How can it run parallel as "The super-execution waits until the subprocess is completely ended (from guide)"??

From User Guide Snippet:

When process execution arrives in the call activity, a new execution is created that is a sub-execution of the execution that arrives in the call activity. This sub-execution is then used to execute the subprocess, potentially creating parallel child execution as within a regular process. The super-execution waits until the subprocess is completely ended, and continues the original process afterwards.

Also, Please help me understand what is meaning of 'Sequence flow can not cross Sub-Process boundaries.'??

Many thanks for clarification of concepts.
6 REPLIES 6

monika_b
Champ in-the-making
Champ in-the-making
I have created a workflow where I am having a workflow with a 'callactiviti calling another workflow' . After running the same getting ACT_HI_* tables data as below in text file.
Pasting same here:

ID         PROC_DEF_ID                             PROC_INST_ID  EXECUTION_ID         ACT_ID_        CALL_PROC_INST_ID      ACT_NAME     ACT_TYPE
29710 myCallActivitiProcess:5:29704 29709         29709         startevent1          Start     startEvent
29713 myCallActivitiProcess:5:29704 29709         29712         callactivity1 29714  Call CA1    callActivity
29715 SubCAProcess:5:29708                 29714         29714         startevent1    Start     startEvent
29716 SubCAProcess:5:29708                 29714  29714  servicetask1           Service Task   serviceTask
29718 SubCAProcess:5:29708                 29714  29714  endevent1    End     endEvent
29719 myCallActivitiProcess:5:29704 29709  29709         servicetask2    JavaServiceCA2 serviceTask
29720 myCallActivitiProcess:5:29704 29709  29709  endevent1    End     endEvent


I have some question please help how execution id is getting changed from subprocess to callactiviti(subprocess) calls. I see 3 execution Ids. With one callActiviti I was expecting exactly 2 execution Ids.(One for super process and one for call activiti subprocess)

Thanks in advance for help. Smiley Happy

frederikherema1
Star Contributor
Star Contributor
1) If you have a regular sub-process, it is modelled as a part of the parent worklfow (in the same BPMN and as a child of the <process> XML element). If the sub-process you want to call is subject to change, independent of the parent-process, you can use a call-activity. The sub-process that is called is an EXTERNAL process (not part of the parent BPMN, but lives in it's own BPMN). This allows you to redeploy the child-process without the need to alter the parent-process. A normal sub-process is treated as a direct child of the process-instance, so you can access the parent's process-variables from within the sub-process. On the contrary, a call-activity does not have access to the parent variables and is a "process instance" itself. You can expose variables from the parent-process to the call-activity by using the in/out declarations (see userguide).

2) If you want to run a sub-process in parallel with other activities in the parent-process, you'll need to add a parallel gateway in front the sub-process element and the "normal" activity in the process. At the point where you want to join the two parallel paths (normal activities in parent and subprocess as a whole) you add another joining parallel gateway (see userguide for fork/join example). The parent process will only move past the "join" gataway IF both subprocess is complete and normal activities before the join in the parent are complete.

3) If you have a sub-process, all sequence-flows in that sub-process should have a target that also is part of the sub-process. You cannot, for example, make the subprocess flow to a userTask that is part of the parent-process. For subprocess-to-parent communication, use boundary-events or similar mechanism.

Hope this answers your questions…

monika_b
Champ in-the-making
Champ in-the-making
<b>Q: Can we have multiple inflow/outflow into subprocess inside a process? </b> Is there any container(other than call activiti) that can have this??  I want to access super process variables inside subprocess.

monika_b
Champ in-the-making
Champ in-the-making
Thanks Fred for wonderful and clear explanations. This helped much.

Just 1 more Q,  <b>Can we have multiple inflow/outflow into subprocess inside a process?</b> Probably without boundary events just through conditional expressions?

frederikherema1
Star Contributor
Star Contributor
Sure you can. Beware that, if multiple flows come into the subprocess at runtime, multiple sub-processes can be started. So it's indeed a good idea to make the boundary-event will not create a new sub-process in case there is already one active due to another sequence-flow arriving there before the event took place. Using a variable and a conditional flow is the best way to prevent this, or make sure the "scope" the boundary-event is on, is destroyed when the other sequence-flow is taken.

monika_b
Champ in-the-making
Champ in-the-making
Thanks Fred for the help.  Smiley Happy