jBPM5 offers a powerful open source BPM engine that you may want to implement in your company to address users needs such as business workflows, rules and events (if you want to understand jBPM5 a little bit more check out this introductory post). You may be wondering: how do I start?
If you are a Maven user, you are used to create POM file that describe your project and let Maven take care about dependencies and the build process. This post aims to give you an initial POM to use in your own projects and start building jBPM5 applications faster.
Creating our jBPM5 application POM
First, you need to have a jBPM5 distribution installed in your local Maven repository. In order to have it you need to follow these steps first.
Once you have the jBPM5 jars inside the local repo you can use your favorite IDE to create a Maven project POM and add the following dependencies (given that you build the jBPM5 yourself following the previous link):
As you may notice, I added the SNAPSHOT version so you can have the latest code. If you want to try a more stable version, change it to 5.0-CR1. However you’ll have to checkout the 5.0-CR1 branch from the repository, build and install it yourself.
With this little bit of Maven magic, we can now create a small HelloWorld test class to instanciate a process and see that everything is working as planned. You can download the POM and the Java test classes from the Plugtree’s GITHUB server.
Saying Hello to our Process World
After you download the sources, you can inspect the HelloWorldTest source. Inside the source code you will notice a readKnowledgeBase method that sets up several factories in order to jBPM5 to be active inside the Drools Sessions:
If we don’t configure these factories Drools will try to use its internal process engine (Drools Flow). In the latest version of Drools this is not necessary, as it will autodetect the presence of jBPM5 and configure itself accordingly. However as the jBPM5 distribution is configured to use Drools 5.2.0-alpha1 and not the Drools SNAPSHOT, this is not done automagically.
There’s another bunch of configuring to do:
KnowledgeSessionConfiguration config = KnowledgeBaseFactory
In this case we tell Drools to use two jBPM5 related class factory. That’s all. You can extend the example further by creating new BPMN2 processes and execute them in the test (if you haven’t yet figured out , you can execute the test by calling ‘mvn test’).
Now you should be able to develop jBPM5 based applications using this Maven POM and HelloWorld test class as a base. In the next few posts, we will model a process, deploy it and finally execute it.
JBPM5 professional services
Plugtree LLC offers enterprise services for jBPM5 and Drools 5: custom training suited to your company’s needs, a variety of consulting topics from architecture reviews, best practices and performance tuning, and an all encompassing production support with SLAs according to your needs. We’ve helped dozens of clients to adopt the Drools and jBPM technologies across a variety of industries and you can be one of them too. Contact us: firstname.lastname@example.org