So, me and some friends are currently playing around with the Camunda modeler. We have managed to deploy a simple process as a Spring boot application which basically starts with a user task and moves to a service task and then ends.
In another repository we have developed a microservice which takes a request which has a customerId and returns a name as a response.
The thing we want to achieve is basically coupling the actual microservice with the service task so that the customerId that you send in through the Camunda cockpit gets sent as a request to the microservice which in turn returns the name as a response back in the Camunda process.
We have looked a little bit on the Java delegate interface but we are not sure that it is the right thing to do. The microservice works when we send a request with Postman.
@simonrisberg, your assumption was correct. There are two approaches. Either from Java delegate on service task you can invoke the rest api or can invoke using external-task-pattern
Your service task in Camunda can call the microservice either through scripting, java delegate, or via an external task. When the process arrives at the task it will run the code to contact your microservice and from there you can do what you want with the response. A typical use-case would be to set a process variable to contain the returned values.
So, we have managed to couple our microservices with our service tasks. However, right now Camunda does not save the history of the different paths that the processes have taken. Does someone here have any experience in how to implement this?
If you don’t want to use the enterprise version and run your engine with a history level greater than NONE, you can query the history either by REST Api (https://docs.camunda.org/manual/7.11/reference/rest/history/) or in the database directly.