Asynchronous service task implementation

Hi Team,

For my product, I’m looking to add a service task to the business workflow. However, its implementation can be synchronous/asynchronous. Synchronous communication will be implemented by calling the HTTP endpoint of an API inside the microservice. Asynchronous communication will be implemented in multiple ways (call & callback URL, posting a message on the queue, publishing an event).

Can this be implemented using the same service task? I know the Asynchronous before & Asynchronous after features provided in Camunda’s service task. As per my understanding, this feature is related to persisting the state of the workflow into the database. What I’m looking for is different than that.

I appreciate your responses.

Thank you.
Bhavesh G

Hello @bhaveshGawade ,

the Service task itself is meant to be atomic, you can do synchronous communication there, for example request/response or send/ack.

If you want to receive a response after sending an async request, you can use the message receive event. The correlation of the returned response to the correct process instance and event can be implemented by you or controlled via REST API.

For more information, please look here: Correlate a Message | docs.camunda.org

I hope this helps

Jonathan

1 Like