Long running external REST Api call in the Service task

Hi Team,

I have 20+ service task. and i made all the service task “flowable:async=“true”” in BPMN.xml

so in my 10th service task, im calling(REST call) an external api it takes 8 mintues to execute and return the response back to service task.

once the response back , im getting FlowableOptimisticLockingException

(org.flowable.common.engine.api.FlowableOptimisticLockingException: Execution[ id ‘09f7f5fd-676e-11ea-b9c2-0050568e1cce’ ] - activity ‘phase2-execute’ - parent ‘09f732a4-676e-11ea-b9c2-0050568e1cce’ was updated by another transaction concurrently)

but instead of going into next service task as per the sequence flow defined , it is trying the same service task again and again this is keep on going …

bpmn.xml as follows,

< serviceTask id=“phase1” name=“phase1-execute”
flowable:async=“true” flowable:delegateExpression="${phase1Service}" >
< extensionElements>
flowable:failedJobRetryTimeCycle>R1/PT1M</flowable:failedJobRetryTimeCycle
< /extensionElements>
< /serviceTask>

< sequenceFlow sourceRef=“phase1” targetRef=“phase2” />

< serviceTask id=“phase2” name=“phase2-execute”
flowable:async=“true” flowable:delegateExpression="${phase2Service}" >
< extensionElements >
flowable:failedJobRetryTimeCycle>R1/PT1M</flowable:failedJobRetryTimeCycle
< /extensionElements>
< /serviceTask>

kindly help me to resolve this issue

Just to clarify, your issue is just with this single task?

I suspect you are running into the async executor’s 5 minute lock. The other async executors think the job has been killed without releasing the lock and start a new instance. How to change the 5 minute timeout interval for a async job?

You can either increase the timeout, to one that better meets your needs, or you can switch to using a triggerable service task and trigger the execution when the long running REST call returns.

Thanks wwitt for the reply.

im facing this issue in total 3 of my service task out of 30.

is it possible to set this time out settings in spring external cofig file?
i want it to be 15 minute

“flowable:
process:
async:
executor:
keep-alive-time: 15000
or
async-job-lock-time-in-millis: 900,000(15601000)”

can i set this value like this? kindly correct me if im wrong

With such a long wait, I wonder whether the problem might be better solved using events in some way rather that HTTP? Adds some complexity but gives a lot more control and scalability, I think.

Cheers
Paul.