How do I get the service task to wait/ pause?

I want the execution flow to wait before the service task is executed(the service task consists of a get call to a rest api). What element of bpmn do i add to get this working?

Also, I want it to proceed from the service task only after it reads a response. What do I do in this case?

PS: I want to do this only via javascript and the bpmn modeler.

Edit:
Consider an approval request usecase. A service task within the bpmn makes a get call, and based on the response, the flow proceeds. The response of the get call is generated only after the approver “approves/ rejects” from his 3rd party app. So, I want it to pause between the approver approving and the get call.
Thank you,
Shrisha.

1 Like

You say wait, but wait for what exactly? If you mean just a certain amount of time, you can add an intermediate timer event in front of the service task and configure the time before it fires. If you’re waiting for a signal of some kind, most often an intermediate message event or a receive task is appropriate.

Fro the service task implementation, the default mode is synchronous request/reply. With the external task pattern, you can assign to a worker that locks the task, executes it asynchronously and reports completion when it’s done. If the process itself is truly asynchronous, you can also follow the service task with a receive task and wait for the reply there. In that case, the service task is just a synchronous firing-off of a command, and the receive task handles the asynchronous response.

1 Like

Consider an approval request usecase. A service task within the bpmn makes a get call, and based on the response, the flow proceeds. The response of the get call is generated only after the approver “approves/ rejects” from his 3rd party app. So, I want it to pause between the approver approving and the get call.

I don’t quite follow what you mean by this. Can you show the flow you have so far so we can discuss the addition of the wait?

@Shrisha_Wagle you are describing a Send/Receive Task scenario, where your third party app has a callback URL that sends a message into the Engine. or you could do a external task client.

Thank you all, I managed to get this working by adding a Message Event