# Handles failures for triggerable java service tasks

**URL:** <https://forum.flowable.org/t/handles-failures-for-triggerable-java-service-tasks/8855>\
**Category:** Flowable Engine\
**Created:** [January 12, 2022, 1:53pm UTC](https://forum.flowable.org/t/handles-failures-for-triggerable-java-service-tasks/8855 "2022-01-12T13:53:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mnithinkk](https://avatars.discourse-cdn.com/v4/letter/m/58956e/32.png) [@mnithinkk](https://forum.flowable.org/u/mnithinkk)\
**Post date:** [January 12, 2022, 1:53pm UTC](https://forum.flowable.org/t/handles-failures-for-triggerable-java-service-tasks/8855/1 "2022-01-12T13:53:36Z")

</div>

I’m not sure how to handle retries when it comes to handling failures for triggerable service tasks.

Let’s take a simple bpmn where it follows startEvent → serviceTask (async = true and triggerable = true) → endEvent

serviceTask (our custom JavaDelegate) makes rest calls to another service (let’s call serviceB) and goes to a wait state. Then serviceB will make callback to our flowable service with either SUCCESS/FAILURE callback. In case of SUCCESS callback, I can trigger and complete the task.

requirement: In case of failure callback, how do I ensure to retry the JavaDelegate.execute() method again? because the control of the flowable is in wait state of serviceTask now.

Our use case is to retry above requirement 3 times. After 3 retries move the execution to deadletter. When trying to bring back the execution from deadletter, again it should start from JavaDelegate.execute().

---

<div class="post-metadata">

**Author:** ![mnithinkk](https://avatars.discourse-cdn.com/v4/letter/m/58956e/32.png) [@mnithinkk](https://forum.flowable.org/u/mnithinkk)\
**Post date:** [January 16, 2022, 3:30am UTC](https://forum.flowable.org/t/handles-failures-for-triggerable-java-service-tasks/8855/2 "2022-01-16T03:30:46Z")

</div>

Hi, does anyone have some input to this issue. It would be very helpful.  
Currently we are blocked due to this.

flowable version used: 6.4.1

---

<div class="post-metadata">

**Author:** ![joram](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/joram/32/26_2.png) [@joram](https://forum.flowable.org/u/joram)\
**Post date:** [January 24, 2022, 3:44pm UTC](https://forum.flowable.org/t/handles-failures-for-triggerable-java-service-tasks/8855/3 "2022-01-24T15:44:18Z")

</div>

> [@mnithinkk](#):
>
> In case of failure callback,

What is a failure in this case? Is it a timeout → if so use a timer boundary event. Or is it a state being sent back? If so, why not model it with a loop back to the service task and store a process variable with a counter?

---

<div class="post-metadata">

**Author:** ![mnithinkk](https://avatars.discourse-cdn.com/v4/letter/m/58956e/32.png) [@mnithinkk](https://forum.flowable.org/u/mnithinkk)\
**Post date:** [January 26, 2022, 2:48pm UTC](https://forum.flowable.org/t/handles-failures-for-triggerable-java-service-tasks/8855/4 "2022-01-26T14:48:23Z")

</div>

@joram, Yes it’s a state being sent from the external system.

We make http calls from our JavaDelegate and move to a wait state (as the serviceTask is marked triggerable = true). After this, we will receive a callback with status = SUCCESS/FAILED depending upon what happened with the processing of the http call we initially made.

In case of FAILURE state, we wanted to re-run the JavaDelegate again (and subsequently make another http call).
