Skip to content

meyerdan/camunda-worker-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

camunda-worker-java

Implement workers for external tasks in Camunda BPM in Java.

Alternative Versions: NodeJS, Akka / Scala

Summary

This tool provides a Java interface to external tasks exposed by the process engine.

Getting started

Note: you need a special fork of the Camunda BPM Platform to be able to use this.

Example of a Java consumer

public class MyApp {

  public static void main(String[] args) {

    CamundaClient client = CamundaClient.create()
      .endpointUrl("http://localhost:8080/engine-rest/")
      .build();

    WorkerRegistration registration = client.registerWorker()
      .topicName("reserveOrderItems")
      .lockTime(5000)
      .worker(new Worker() {

        public void doWork(TaskContext taskContext) {

          // do the work
          
          // if the work was successful, complete the task
          taskContext.complete();
          
          // else if the work was un-successful, fail the task
          taskContext.failed("some error message");

        }
      })
      .build();

  }

}

Maven dependency

<dependency>
  <groupId>org.camunda.bpm.ext</groupId>
  <artifactId>camunda-bpm-sdk-java</artifactId>
  <version>0.0.1-SNAPSHOT</version>
</dependency>

Features

  • Efficient Threading & Multipoll: single thread polling multiple topics at once delegating to a pool of worker threads
  • Adaptive Polling with Exponential Backoff: poller dynamically adjusts to avaiable work and backs off in case no work is available.

About

Competing Consumers (aka. Workers) for Camunda BPM

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages