This project provides a Spring Boot starter that allows you to implement an external task worker for Camunda. It uses the Camunda REST API to fetch, lock and complete external services tasks. It is based on the Camunda External Task Client
This project is not yet there and still need to be worked on.
There is an implementation here: https://github.com/osteinhauer/camunda-external-task-client-java-spring. Currently undecided if this will be based on that code or not.
You need this dependency in order to get started
<dependencies>
...
<dependency>
<groupId>org.camunda.bpm.extension.spring.boot</groupId>
<artifactId>camunda-external-task-client-spring-boot-starter</artifactId>
<version>...</version>
</dependency>
...
</dependencies>
@ExternalTaskSubscription("invoiceCreator")
@Component
public class InvoiceCreator implements ExternalTaskHandler {
void execute(ExternalTask externalTask, ExternalTaskService externalTaskService);
}
In order to enable the external task subscriptions you have to do use the EnableExternalTaskSubscriptions
annotation. You can configure the Camunda endpoint and other properties there.
@Configuration
@EnableExternalTaskSubscriptions(baseUrl = "http://localhost:8080/rest")
public class SimpleConfiguration {
}
You can also use other ways to configure it via normal Spring possibilities:
camunda:
bpm:
client:
base-url: http://localhost:8080/rest
Check tests and examples for usage.
You can also use the basic Spriung integration without the Spring Boot Starter:
<dependencies>
...
<dependency>
<groupId>org.camunda.bpm.extension.spring</groupId>
<artifactId>camunda-external-task-client-spring</artifactId>
<version>...</version>
</dependency>
...
</dependencies>
-
Connection resilience / retrying in case the engine is not available (also during startup of the client)
-
Multiple ExternalTask subsctiptions on one handler?
@ExternalTask("invoiceCreator") @ExternalTask(topicName = "invoiceCreator", lockDuration = 1000) @ExternalTask(topicName = "offerCreator", lockDuration = 2000) @Component public class InvoiceCreator implements ExternalTaskHandler { void execute(ExternalTask externalTask, ExternalTaskService externalTaskService); }