How do I run "Standalone" Camunda engine (with cockpit, rest api, etc.) and have my existing Spring Boot application serving the tasks (JavaDelegate)

Viewed 443

I already have my Spring Boot application running in production. Now I want to work on the workflow feature of our application. What I want is that my Spring Boot application runs on Server 1 (as it is today) and Camunda engine runs on Server 2. However I want all the tasks to be written in my existing Spring Boot application.

enter image description here

How can I achieve this?

1 Answers

Here is how my project team implemented it:

  1. Set Task 1 and Task2 to use implementation = External Task and put suitable topic names.
  2. Add "Spring Boot Starter for the External Task Client" to your existing Spring Boot application by following the steps @ https://camunda.com/blog/2021/03/external-task-client-spring-bootified/
  3. Implement ExternalTaskHandler for each of the topics.

Every time a process instance runs on your Camunda server and reaches at Task 1 and consequently Task 2 steps, Camunda server adds the instance to the external task queue for Task 1 or Task 2. You Spring Boot application, acting as the external task client, will periodically polls Camunda server for such tasks and upon receiving one, it will perform the necessary business logic need to fulfill the task requirement.

Upon completion, the task handler will need to report back either it successfully completes the task or not by either calling externalTaskService.complete() for success or call externalTaskService.handleFailure() or externalTaskService.handleBpmnError() for error. handleFailure() will create an incident for that instance while handleBpmnError() throws an error event that you can catch within the flow to divert the process to, for example, a retry loop or a user task creation.

Related