{{announcement.body}}
{{announcement.title}}

Understanding Red Hat Process Automation Manager (JBPM)

DZone 's Guide to

Understanding Red Hat Process Automation Manager (JBPM)

In this article, we provide a walkthrough of how to get started with and common challenges surrounding Red Hat Process Automation Manager (JBPM).

· DevOps Zone ·
Free Resource

This article talks about PAM development and its benefits and challenges. I will be sharing my experiences which I learned from my most recent project.

PAM comes with Business-central and Kiesever. Business-central has assets that help in building process flows and domain objects and writing rules using drools. Kieserver is a runtime environment for our assets. PAM has a built-in H2 DB and also has options to integrate with other DB's like Oracle, PostgreSQL, and MySQL. PAM can be deployed on any app server or web server. 

Types of architectures:

  • PAM can be directly embedded into an application as a library. The application will communicate with PAM using simple APIs. 
  • PAM can be deployed as a standalone. An application will communicate with PAM using REST APIs. This follows the separation of concerns pattern. So components can be easily salable. I will be talking more about this later.
  • PAM can be deployed as big, complex monolithic application. It includes UI (forms), Java, and process definitions together in one unit. This brings all sorts of problems like maintainability and scalability. It's not one of our favorite architectures.

Let's talk about below follow. All components can be built as separate microservices. There is a clear separation of roles and responsibilities, so they can be scaled easily.

Microservice architecture

Microservice architecture

Let us begin with a small business scenario. An employee in a company wants to take a vacation. All the employee needs to do is to fill in the time-off application form. After that, they have to submit the form to their manager for approval. The request can also be declined automatically if the employee doesn't have any time-off left. 

Time-off request workflow

Time-off request workflow

The employee is a Data Object (POJO). It will be the input to the Process flow. The Process flow also has other assets, like User Task, Business Rule Task, and gateways. I also defined a process variable in the process flow which is "application" of type Employee.

The input JSON to the Process flow should be in the following format.  The key, "application", should be the same as the process variable name. It is mandatory to specify the package, "com.dzone.leave.Employee"

JSON


This JSON will be posted to the Process flow at the time that process instantiation happens through a REST call. JSON gets mapped to the Employee Object, and it can be accessed through a process variable or Kcontext from any BPM Task. Kcontext is a predefined variable that references the ProcessContext object.

Java code can be added in any BPM Task, but try avoiding complex Jave code. PAM doesn't come with an IDE to validate the Java code. Everything happens in the web browser.

PAM provides the REST URLs to access process flows from the application. For example, the status of the User Task can be changed by calling the respective REST URL from the application: http://localhost:8080/kie-server/docs/

Let's move on to the Business Rule task. PAM provides various options to build rules. I have used the guided rule template, which helps you to build complex rules. But you should know how to use the UI features. Here's a sample rule file:

Plain Text


ruleflow-group "gropup1" is referred from the Business Rule task. You can have multiple rules and group them under one umbrella that you can refer to from the Process flow. The salience option can be used if the rules depend on each other. A higher salience value will have higher priority. The @watch annotation is very useful in combination with the salience feature if the rules are dependent on each other. Sometimes, salience is very silent when there is a complex rule that has a dependency.

Cache Issues 

There can be frequent code caching issues during development. Cache cleaning is required when multiple changes happen to the same file. Try the following commands to clean cache for JBoss EAP.

Shell


There are several additional challenges that you could be faced with. PAM tool gets stuck very often during development and has very volatile behavior. The lack of documentation and community support is very low. Despite, these, it's a pretty simple tool to learn and can be very powerful when used correctly. 

Topics:
devops, jbpm, process automation, red hat, tutorial

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}