using the camunda batch execution for custom batch runs
Java
Clone or download
Pull request Compare This branch is 37 commits ahead of pschalk:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
docs
examples
extension
.editorconfig
.gitignore
.java-version
.travis.yml
CONTRIBUTING.md
LICENSE
README.adoc
pom.xml

README.adoc

camunda-bpm-custom-batch

camunda bpm custom batch
License Apache%202.0 blue
badge

The goal of this camunda extension is to provide an simple way of using the camunda batch functionality. Camunda Batch could be used to split a huge workload into small asynchronous jobs. With this extension, we want to open the camunda batch functionality to everyone.

Why should I use this extension

Camunda batch is really cool for offloading huge workload into small asynchronous pieces of work. E.g.:

  • Unclaiming / Updating a hugh list of camunda tasks

Get started

The extension will be published on maven central, so if you are using maven, just add the dependency:

<dependency>
  <groupId>org.camunda.bpm.extension.batch</groupId>
  <artifactId>camunda-bpm-custom-batch-core</artifactId>
  <version>1.1.0</version>
</dependency>

First you have to define an own job handler for working on the single batch data:

@Component
public class PrintStringBatchJobHandler extends CustomBatchJobHandler<String> {
  @Override
  public void execute(List<String> data, CommandContext commandContext) {
      logger.info("Work on data: {}", data.get(0));
  }

  @Override
  public String getType() {
      return "print-string-batch-handler";
  }
}

Next you have to notify the engine about this job handler, e.g. with spring-boot:

@Bean
public ProcessEnginePlugin customBatchHandlerPlugin(PrintStringBatchJobHandler printStringBatchJobHandler) {
  return CustomBatchHandlerPlugin.of(printStringBatchJobHandler);
}

Finally, the creation of the batch itself:

CustomBatchBuilder.of(listOfStringData)
  .jobHandler(printStringBatchJobHandler)
  .create();

Or with more configuration:

CustomBatchBuilder.of(listOfStringData)
  .configuration(engineConfiguration)
  .jobHandler(printStringBatchJobHandler)
  .jobsPerSeed(10)
  .invocationsPerBatchJob(5)
  .create(engineConfiguration.getCommandExecutorTxRequired());

Resources

Roadmap

todo

  • Provide a data collector class

  • Provide a timer job for automatically triggering of batch creation

done

  • Provide initial version

Maintainer

Sponsor

License

Apache License, Version 2.0