External Task, Jobs and retry time cycle


#1

Hi all,

I’m working with camunda using the API rest, and I have some external tasks, and I need to set a retry time cycle for this external task when I marked as failure, but I don’t know how to do it.
Let me explain a little more.
Think about this example https://github.com/camunda/camunda-bpm-examples/tree/master/process-engine-plugin/failed-job-retry-profile but external tasks instead having a Java Class as implementation, have an External Implementation.
I have a camunda plugin, wich every external task who starts, publish a message into kafka, then, my application process this json, and via REST will fetchAndLock this task, and if an error occurs, mark as failure with a retry time cycle.
What i’m spect of this behaviour is this external task start again from the beginning and my kafka plugin publish again the start event for this external task.

I was reading about jobs, but I don’t know how they works and if a Jobs it’s a part of an external task or they are different “things”.

To summarize, I need in some way my external tasks publish an start event when they failed after a period of time.

Thanks!


#2

I found this library and seems to be perfect for my requirements https://github.com/camunda/camunda-external-task-client-java

I also have one doubt, how exponential Backoff Strategy works? I know the theory, but I don’t know how it works on this library.

Thanks!


#3

Hi @pipeline,

when you use external task, you have to handle the retries and the time between in the worker. Have a look at the docs: https://docs.camunda.org/manual/7.10/user-guide/process-engine/external-tasks/#reporting-task-failure.

Hope this helps, Ingo


#4

Hi @pipeline,

the backoff strategy waits for the fetch-and-lock call 2 times as long as in the call before, when the fetch-and-lock replies no tasks. Max wait time is 1 minute.

The wait interval is 500ms, 1s, 2s, 4s, 8s, 16s, 32s, 1m, 1m, … until the next task arrives for the worker.

Hope this helps, Ingo


#5

Thanks a lot for your answer, I was diving into library code and with your help I finally understood how backoff works on this lib.
This library do all the things that I was going to implement using Quartz, to have some kind a cron to ask about tasks.

I’m looking for something similar but for retryTimeout param in externalTask or like job retry time cycle, but I think this is a nice workaround.

Anyway, thanks for take some time to answer :slight_smile: