cancel
Showing results for 
Search instead for 
Did you mean: 

cancelActivity=true not working for service tasks

tcarl
Champ in-the-making
Champ in-the-making
Hi,

I have a service tasks that waits for a synchronous response to come back. If a timeout is reached (timer boundary event), I want the subprocess to be canceled (cancelActivity=true).
I already found out the hard way that the boundary events don't work on service tasks, so I wrapped the service tasks in a subprocess scope.
Still the service task execution is not getting cancelled although the time boundary event is triggered. I was expecting that the service task thread (async=true) is getting signaled.

My questions:
- Is support for boundary events on service tasks planned?
- The fact that the service task thread continues to run, is that a bug or a feature?
- Is there a way to store an error code in process variables? I would like to have a catch-all for errors happening in the process and create a notification with that error code.

Thanks,
Timo
2 REPLIES 2

frederikherema1
Star Contributor
Star Contributor
1. No support for this is planned
2. The cancelActivity uses the database to cancel the running activity. As long as the async service-task is "running", the process-state in the DB is unaffected. When the service-tasks finished and tries to write it's data, it will get an optimistic lock-exception, effectively rolling back the work it did in the service-tasks, so transactionally speaking, it "never happened". There is no way of "notifying" or "canceling" the job-threads at the moment. Also a bit difficult to implement right, keeping in mind job-executor may be in different VM…
3. Do you mean the error-codes in the BPMNErrors/thowing boundary event?

tcarl
Champ in-the-making
Champ in-the-making
Thanks for your quick reply.

In re:2
Is there a way for the running thread to check if it should shutdown? How would you generally implement a synchronous invocation that should be interrupted at a certain timeout?

About 3)
I have a fairly simple process in mind that executes a number of steps. Each step can fail and essentially break out of the happy path. In a catch-all event subprocess I would like to notify which error code triggered the error start event. The error would be raised in a JavaDelegate by throwing BpmnError.
With that information I can tell the user if a process was successful or failed and why it failed.
How can I accomplish this scenario?

Thanks,
Timo