External task patterns for HTTP requests

I have a microservice(orderservice) which maintains list of orders. For fetching the orders we have some business logic in the microservice. So using external service pattern can i call the orderservice rest api to get the list of orders?

Will external client can store the response of api call in db or it will persist only status of that task whether completed or failed?

Using external task pattern can we set input variables and values for next immediate step? And how can be achieved?

I short, no you cannot call the Order-Service from External Task. The External Task pattern utilizes a polling mechanism. Your Order Service or a Worker would poll Camunda for tasks to complete.
The way this commonly works is;

  • A task worker will fetch and lock tasks from Camunda
  • The task worker then calls your Order Service to do the work.
  • When the order-service completes its work the task worker would then complete the task(s) in Camunda.

You can pass a payload to the External Task upon completion of the task.
https://docs.camunda.org/manual/latest/reference/rest/external-task/post-complete/

An external task client is a simple client that allows you to implement business logic of your choosing and interact easily with the Camunda External Task REST api. You could choose to persist the payload from the order service as process variables.

@plungu thanks for your reply. My payload object is like below,

public class MyOrder{
     private String customerId;
     private String customerName;
     private List<Order> orderList;
     ....
    //getters and setters
}

image

Here my payload is object. To persist this payload i have to serialize the object into string format. When i specify objectTypename=Object in the valueInfo section, while deserializing it should we need the MyOrder and Order classes in classpath?

Note that i was using camunda spring boot starters as microservice application(camundaservice). I will be doing object serialization in Task workers and deserializing in camundaservice?