Accessing the execution id of a service task with a boundary event within execution listener of this boundary event

109 views
Skip to first unread message

Vadym Elkind

unread,
Jul 8, 2015, 11:31:16 AM7/8/15
to camunda-...@googlegroups.com
Hello guys,

couldn't find anything appropriate about this topic. As I know, the execution id of a task with a boundary event differs from the general execution id.
In my scenario I attached an execution listener to the boundary event of a service task and I need to get the execution id of this service task from this execution listener.
I could save the execution id of the service task as a process variable and then access it within the execution listener class, but I believe there should be a more elegant way to do it.

Thanks in advance.


Regards
Vadym

thorben....@camunda.com

unread,
Jul 8, 2015, 11:48:17 AM7/8/15
to camunda-...@googlegroups.com
Hi Vadym,

This is not possible other than the way you describe. The reason is that before any listeners for the boundary events are executed, the activity instance it is attached to in case of a cancelling boundary event is already cancelled including removal of the execution. For a non-interrupting event, the execution still exists, yet there is no currently no way to identify it unambiguously. What's the use case you need it for?

Cheers,
Thorben
Message has been deleted

Vadym Elkind

unread,
Jul 8, 2015, 12:17:46 PM7/8/15
to camunda-...@googlegroups.com
Hello Thorben,

thank you for your fast reply.

I need in to inform an external task management application, that the task with a certain execution id is not valid any more and should be marked as cancelled in case the boundary event fires.
I have to store the execution id of the service task in the external task management application anyway, as I use it to trigger the execution of the corresponding camunda (asynchronous) task after this task was completed in the external application...
So in case the event fires I could find the correlated task in external system using the execution id of the service task and mark it as cancelled there.


Regards
Vadym

thorben....@camunda.com

unread,
Jul 8, 2015, 12:38:56 PM7/8/15
to camunda-...@googlegroups.com
Hi Vadym,

Perhaps you can use an execution listener on the service task's "end" event to determine its cancellation. There you are handed the correct execution and via execution#isCancelled, you should be able to determine if the service task is cancelled or ends properly.

Cheers,
Thorben

Vadym Elkind

unread,
Jul 8, 2015, 2:13:40 PM7/8/15
to camunda-...@googlegroups.com
Hello Thorben,

Thank you for this advice. It works how it should. The isCancelled method is really useful.

Regards,
Vadym
Reply all
Reply to author
Forward
0 new messages