cancel
Showing results for 
Search instead for 
Did you mean: 

Wrong executionId when using Error Boundary Event

bkonrad
Champ in-the-making
Champ in-the-making
Hi,

i have a problem getting the correct executionId in a Service Task which has a Error Boundary Event defined:

[img]https://drive.google.com/file/d/0B4B-GQHdB3Xta0dELTJiSVpQRms/view?usp=sharing[/img]
https://drive.google.com/file/d/0B4B-GQHdB3Xta0dELTJiSVpQRms/view?usp=sharing

When the processinstance reaches the wait task, an I want to signal the execution, but the executionId retrieved from Task 1 can not be found in RuntimeService.signal(), when using the processInstanceId for signalling, everything works.

Is there anything wrong or is this a bug?

Regards,
Björn
7 REPLIES 7

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

jUnit test would help (https://forums.activiti.org/content/sticky-how-write-unit-test), but I would say that boundary event is registered with the process instanceId.

Regards
Martin

bkonrad
Champ in-the-making
Champ in-the-making
But why does Activiti give me an exceutionId in the JavaDelegate of Task 1, which is NOT the processIntanceId?

jbarrez
Star Contributor
Star Contributor
Because a process instance is stored as an execution tree. The process instance does not visit the step, but a child execution does.
Use execution.getProcessInstanceId() from the execution in the JavaDelegate to get the process instance id.

bkonrad
Champ in-the-making
Champ in-the-making
Yes, this would solve my concrete problem here, but if I would like to reuse the same JavaDelegate in another process, where I have a parallel execution, i can not reuse it, because I need the specific executionId of my parallel execution

jbarrez
Star Contributor
Star Contributor
Why would you need in one instance the specific execution id and in the other the process instance id?
It's generally not a good idea to depend on the structure of the execution tree in logic, as it is completely dependent on the actual process definition structure.

bkonrad
Champ in-the-making
Champ in-the-making
You misunderstood me, what I mean is "in another process-definition" - not instance. We have many Processdefinitions, which use the same JavaDelegate Code.

So, having a Processdefinition with a Service Task in a parallel execution and having another Processdefinition with a Error-Boundary attached to a Service Task, both using the same JavaDelegate - what ID should I use? execution id vs. process instance id

jbarrez
Star Contributor
Star Contributor
I'm not misunderstanding you … I'll repeat my advice from previous comment: it's generally not a good practice to depend on the structure of the execution tree i.e. use the executionId.