Event sub-process scope of variables from message start event


#1

Hi guys,

I am struggling with the event sub process (non interrupted).

When a message is caught in event sub-process start event it seems variables are always created in the scope of the host process.
If the event sub-process is non interrupting it can be started multiple times.
How to correlate the data from the message catch events to the respective instance of the event sub-process.

Do I miss something?

I was checking further and I am unable to set any local variable in the scope of the event based process. Is there a reason for that as other types of sub-processes support this?

Thanks for feedback.

Ingo


#2

Hi @pitu72,

the behavior you are encountering is expected with regards to event subprocesses.
The documentation states for processVariablesLocal that

A map of local variables that is injected into the triggered execution or process instance after the message has been delivered

With regard to your process definition, the message start event of the event subprocess leads to the creation of a message subscription for the execution of the enclosing process instance rather than the process definition (as it would be the case for a process-level message start event). Thus, the process instance is the waiting execution that is triggered by the message and therefore also receives the local variables. The execution of the subprocess start event and therefore the creation of the subprocess scope is triggered afterwards.

You could for example now map the process variables - that are created from the message payload - to the event subprocess with an input/output variable mapping.

If you furthermore pass the message payload to process variables transiently, they will not be persisted in the process instance scope and will only be persisted in the event subprocess scope.

Hope that helps.

Cheers,
Tobias


#3

Hi,

a small addition:
Passing the message payload transiently to the waiting execution is described in the REST API for example, just search for transient here.

Cheers,
Tobias


#4

Thanks a lot Tobias that was very helpful explanation.