Parallel task best practices

I have a process in which there are several parallel tasks. Here is what it looks like:

The parallel task are all likely to be services task and they will have the same JavaDelegate implementation with different input parameters value.
Inside the delegate there will be set a new process variable at the end:

delegateExecution.setVariable("outputName", taskResult);

After that I need to access each result individually further in the process.

The problem is how could I model this situation as far as best practices (either Camunda’s or BPMN’s) are concerned?
How each task should set the new process variable?
Is process variable the only solution available?
Is parallel task the best solution in this case?

Thanks for the suggestions.

It’s hard to answer your question without knowing the requirements. Technically, you can have a variable of type List and have each task to add a result there. Or, if you want to know the source of the result, you could have a map (keys are the task names, values are the results). If you do not set any async before/after flags, then all the tasks will be executed in a single thread and you won’t have to worry about synchronizing access to the process variable.

Or you could set differently named variables (result1, result2, …). The name of the variable to set could be passed as a parameter to the task.

There is a mismatch in the process model: gateway types do not match. This is a smell.

That’s why I wrote that without knowing your goal it’s hard to devise a good solution.