camunda-platform-7-custom-batch
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 huge list of camunda tasks
-
Call APIs with batches of data
-
Distribution of emails
-
Technical stuff like clean-up
Get started
The extension will be published on maven central, so if you are using maven, just add the dependency:
Maven Users:
<dependency>
<groupId>org.camunda.community.batch</groupId>
<artifactId>camunda-platform-7-custom-batch-core</artifactId>
<version>1.18.0</version>
</dependency>
Gradle Users:
compile("org.camunda.community.batch:camunda-platform-7-custom-batch-core:1.18.0")
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) {
data.forEach(dataEntry -> logger.info("Work on data entry: " + dataEntry));
}
@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)
.jobPriority(0L)
.invocationsPerBatchJob(5)
.exclusive(true)
.create(engineConfiguration.getCommandExecutorTxRequired());
Note: The batch jobPriority
is only considered when using Job Executor with the corresponding Acquisition Strategy jobExecutorAcquireByPriority
. (see camunda documentation)
The seed and monitor jobs receive the same priority as the batch.
Versions
1.18.0
-
Update to use latest camunda version (7.18)
-
New version schema … minor version number should always reflect the camunda number.
1.6.0
-
Update to use latest camunda version (7.17) + spring boot (2.6.3)
-
BREAKING CHANGE: java package path changed from
org.camunda.bpm.extension.batch
toorg.camunda.community.batch
-
ATTENTION: new maven coordinates!
<groupId>org.camunda.community.batch</groupId>
<artifactId>camunda-platform-7-custom-batch-core</artifactId>
1.5.2
-
Update to use latest camunda version (7.15)
1.5.1
-
Update to use latest camunda version (7.14)
1.5
-
BREAKING CHANGES: This version is needed to be compatible with Camunda Version 7.13! (It will NOT work with with lower camunda versions)
1.4
-
Use gson as json converter to be compatible with camunda release 7.11
1.3
-
Batch Configuration gets now saved as json, but it’s still possible to work on "old" batches because the extension is downwards compatible
-
It’s now possible to set exclusive flag for batch jobs (see Camunda Job Docs)
1.2
-
Batch Job priority could be set
Roadmap
todo
-
Provide a data collector class
-
Provide a timer job for automatically triggering of batch creation
Resources
-
Contributing - check this if you want to contribute
Maintainer
-
[Patrick Schalk](https://github.com/pschalk) - [Holisticon AG](http://www.holisticon.de/)
-
[Stefan Becke](https://github.com/stefanbecke) - [Kühne + Nagel](https://home.kuehne-nagel.com/)
Contributors
-
[Jan Galinski](https://github.com/jangalinski) - [Holisticon AG](http://www.holisticon.de/)
-
[Nils Ernsting](https://github.com/nernsting) - [Holisticon AG](http://www.holisticon.de/)
-
[Stefan Zilske](https://github.com/stefanzilske) - [Holisticon AG](http://www.holisticon.de/)
Sponsor
License
Apache License, Version 2.0