I have a main process, which has a lot of subprocesses and I need to periodically check if some condition is met(the task expires). The process looks like this:
The problem is that the process variable which is needed in the Check expiration task is created at the start of Activity 1(and never changed after that). So until the Activity 1 is finished, I don’t have access to that variable. Is there some way to pass variable to parent process before the subprocess terminates? I can think of a few solution, but like none of them:
- When the variable is set in subprocess, send it via signal/escalation to the parent and handle it there.
- this will clutter the diagram with non-business workaround
- Copy the timer part of the process to Activity 1
- besides not being fan of copy-pasting, this will also cause the handling code to be executed twice as often when in Activity 1.
- Extract the tasks which sets the variable to the parent process
- This looks like a good solution, but I’m reusing the Activity 1 in a different process so I want it to stay self-contained. I would have to add the extracted tasks also to other processes.
- Retrieve it via some services in code(runtimeService.createVariableInstanceQuery maybe?)
- This looks like a best approach, but I’m not sure how to do that in most efficient manner. I think the context of the subprocess won’t be loaded in the thread, right?
I’ve tried to get to the subprocess somehow through DelegateExecution which is passed to my delegate, but couldn’t figure it out
Are there any other options or maybe a different way to model this?