Microservice Call

Hello All,
Can you please suggest me how to call any microservice REST call from the zeebe and how to pass the data for POST type request?. If you have any example than please share link. (Java/spring)

@manish you need to create a Zeebe worker with Zeebe Spring … here is an example: https://github.com/salaboy/zeebe-k8s-getting-started

And here in the worker: https://github.com/salaboy/zeebe-worker-spring-boot-example/blob/master/src/main/java/com/example/demo/DemoApplication.java#L26
Before calling complete you can call your POST endpoint with WebClient or RestTemplate as you normally do in a spring boot application.

Thank you for your quick response. I will do the same and if I need your more support, I will ping you

Hello @salaboy,
This is the way to call rest service from zeebe? Is it correct or I need to modify this sample?

@manish that looks ok to me… any reason why you are not using the spring boot integration? You can use the Zeebe annotations for defining a worker if you want to… but your example looks ok. There is not actual thing of calling a rest service from Zeebe… you just define a worker and do whatever you want from inside it… like calling a rest endpoint using any spring helpers… like restTemplate in your case.

1 Like

Thank you for you reply. It will help me in my work.
I am confusing in the bpmn file code.

<bpmn:serviceTask id=“collect-money” name=“Collect Money”>
<zeebe:taskDefinition type=“payment-service” />
<zeebe:header key=“url” value=“http://localhost:8090/mail?id={{orderId}}” />
<zeebe:header key=“method” value=“GET” />

In above code we have headers. In that we also have Url and its value. So how can we use it to call the api?

@manish from the Job itself you can get the CustomHeaders which is a map with the values that you set in the workflow definition.