DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • What D'Hack Is DPoP?
  • MDC Logging With MuleSoft Runtime 4.4
  • How to Use the Circuit Breaker Functionality in Anypoint MQ
  • How To Use JMS ActiveMQ With Mule 4 - Part 6

Trending

  • No Observability Tool Is the “Best”
  • Five Layers Between Your AI Agent and a Production Outage
  • Engineering Production Agentic Systems: Part 2: The Guardrails
  • Securing Loop Engineering: Six Trust Boundaries for Autonomous Agents

Understanding Red Hat Process Automation Manager (JBPM)

By 
Nehru Singh user avatar
Nehru Singh
·
Mar. 31, 20 · Tutorial
Likes (4)
Comment
Save
Tweet
Share
17.1K Views

Join the DZone community and get the full member experience.

Join For Free

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
 




xxxxxxxxxx
1
11


 
1
{    "application":{ 
2

          
3
      "com.dzone.leave.Employee":{
4

          
5
         "name": "First Name LastName",
6

          
7
         "no" :3214
8

          
9
         "requestedLeaves":15 
10

          
11
      }   } }



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
 




xxxxxxxxxx
1


 
1
rule "LeaveRule"
2
    salience 10
3
    ruleflow-group "gropup1"
4
    dialect "mvel"
5
    when
6
        $emp : Employee( requestedLeaves < 15 )
7
    then
8
        $emp.setLeaveStts( "Approved" )
9
end



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
 




xxxxxxxxxx
1


 
1
rm -rf /opt/jboss-eap-7.2/standalone/tmp/* ; 
2
rm -rf /opt/jboss-eap-7.2/standalone/data/* ; 
3
rm -rf /root/.m2/repository/project/* ; 
4
rm -rf /opt/jboss-eap-7.2/bin/repositories/kie/global/project/*



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. 

application Flow (web browser)

Opinions expressed by DZone contributors are their own.

Related

  • What D'Hack Is DPoP?
  • MDC Logging With MuleSoft Runtime 4.4
  • How to Use the Circuit Breaker Functionality in Anypoint MQ
  • How To Use JMS ActiveMQ With Mule 4 - Part 6

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook