JBatch spec is a nice progress for JavaEE even if few details are not that perfect yet however it only targets devs. That’s why Apache BatchEE tries to tackle production too.
Between all proposals included in this project its CLI (still in progress but already usable) has an interesting feature: bars!
A bar is basically a proprietary (hopefully standardized one day) archive format to deploy batches. The idea is to get kind of war for batches.
This is easily buildable with batchee-maven-plugin (normally gradle integration should come in the following weeks/months) and then you can deploy it directly with batchee-cli!
Here an exploded bar:
└── BATCH-INF ├── classes │ └── mypackage │ └── MyBatchlet.class ├── batch-jobs │ └── mybatch.xml └──lib ├── domain-1.2.3.jar └── core-1.2.3.jar
Basically the idea is to get a libs/ folder with all dependencies, and batch specific stuff in batch/ folder. In this folder you’ll get batch definitions (batch-jobs folder) and additional binaries (.class and config files in classes/).
So how to run your batch now? With batchee-cli you can just execute start command specifying your archive path:
$ java -jar batchee-cli-bundle.jar start -archive demo-1.0.bar -name mybatch ____ _ _ ______ ______ | _ \ | | | | | ____| ____| | |_) | __ _| |_ ___| |__ | |__ | |__ | _ < / _` | __/ __| '_ \| __| | __| | |_) | (_| | || (__| | | | |____| |____ |____/ \__,_|\__\___|_| |_|______|______|0.1-incubating-SNAPSHOT Admin mode deactivated, use -socket to activate it Batch 'mybatch' started with id #0 >>> My batch is executed...just a System.out but it is a demo! ========================= Batch status: COMPLETED Exit status: COMPLETED Duration: 0s =========================
And that’s all!