How do I implement wait for a service task execution

Hi ,

Can anyone please advice how to wait for a service task execution to get complete.
The service task which I trigger is complex and would take several seconds to complete and give me a response which is to be forwarded to the next service task.

Best Regards,

How are you implementing the service task? Java Class or External Task?

default behavior would be that the process would wait for the task to be completed before moving on - what are you experiencing?

Thanks @Niall for the quick response.
My service task is a microservice which I am invoking using camunda connector.

<serviceTask id="step2" name="Service Task1">
        <camunda:inputParameter name="url">http://localhost:8081/test</camunda:inputParameter>
        <camunda:inputParameter name="method">POST</camunda:inputParameter>
        <camunda:inputParameter name="headers">
            <camunda:entry key="Accept">application/json</camunda:entry>
        <camunda:inputParameter name="payload">
          <camunda:script scriptFormat="Javascript">**payload****

<camunda:outputParameter name=“Result”>
<camunda:script scriptFormat=“Javascript”>S(response).prop(‘key’).value()</camunda:script>

The microservice itself has some complex scenarios (and connections to other services) is in itself has wait methods written.
So I was wondering whether I need to write delay time in the bpmn so the execution waits for the response to be fetched.

Bascially your call is going to wait for as long as it takes to get a response from the rest call or it times out.
If you’re doing something that requires a longer waiting time then i would suggest that you don’t use a connector at all. I would suggest an External Task pattern. That way you don’t need to worry about upstream services taking too long.


Thankyou @Niall ,

Would it be possible to create an external service task which is a microservice.
How would i call the microservice in bpmn without the connector?
please advice.

Thanks and Regards,

External tasks are primarily used for microservice architecture. So it would suit you much better.
It might be useful to watch this tutorial to see how its intended to work.

1 Like

Thanks @Niall ,
Can i have a sequence of external tasks in which the next external task depends on the output of the previous one.


Yes - when an external task uses the fetch and lock method it can ask for the process variables of the process. These variables could have been produced by another task.