Business Process Model and Notation – jBPM

Author: Nitish Kumar

Business Process Model and Notation is a way of designing business processes in the form of a diagram consisting of nodes and the transitions. It provides a standard notation to easily understand the business flow by the business personnel, developers, and the analysts.

In this blog, we will mostly focus on the Business Process Management (BPM) system and its implementation in Java as jBPM system. jBPM (Java Business Process Management) is a light weight, open-source BPM suite written in Java. It offers lots of features to support and automate business processes throughout their life cycle:

  1. Web-based process designer for graphical creation of the business flow (drag and drop).
  2. Integration of Human/User task within the process. For example, data validation, document approval, etc.
  3. Service tasks to integrate micro-services within the process.
  4. Customized service tasks (Work Items) to implement the service as per the business requirement.
  5. Integration of process definitions with the Spring boot applications.
  6. Database integration, and many more.

KIE Execution Server

It is a standalone execution server that provides runtime environment to instantiate and execute both business processes and rules. Kie servers are completely configurable and its functionalities can be extended. It uses the Drools engine to provide support for the execution of Business Rules. You can download the latest version of jBPM by following this link.

BPMN 2.0

It stands for Business Process Model and Notation. It defines a standard on how to graphically represent a business process. Its primary goal is to provide a notation that is readily understandable by all business users. It can be used to model, execute, and manage business processes using different tools like jBPM6. The BPMN 2.0 specification defines three main types of nodes:

  1. Events: Used to model the occurrence of a particular event. It could be a start event, intermediate event, and an end event.
  2. Activities: It defines the actions that need to be taken while executing a business process. It could be a Script Task, Human Task, Business Rule Task, Service Task.
  3. Gateways: It can be used to select multiple paths within a process. It works similar to the If-Else condition in the programming languages. It could be parallel gateway, exclusive gateway, inclusive gateway, or an event.

Features of jBPM

  1. Supports BPMN 2.0
  2. UI Tools: UI tools available in the design phase.
  3. Eclipse-Based and Web-Based: Provides drag and drop support for the graphical creation and simulation of our business processes.
  4. Rule Engine: Provides a declarative language that is used to evaluate the available information.
  5. Human Task Services: Includes tasks that need to be performed by humans. It also defines the data structure to store information about the human tasks.

Core Engine

Core Engine executes your business processes. It supports the BPMN2.0 for modelling and running business processes. It can be deployed on any device that supports the java runtime environment. Supports migration of running process instances to a new version of their process definition.

jBPM Core-Engine API

  • Core-Engine creates an API which we need to load processes and execute them.
  • It allows us to first create a Knowledge Base which include all our process definition that needs to be executed by the Session.
  • This session has a reference to the Knowledge Base.
Core Engine API

Knowledge Base

  • A repository of all the relevant process definitions.
  • It contains rules, processes, functions and type models. 
  • A Knowledge Base can be created only once, and it can be changed dynamically.
  • Knowledge Base creation:

KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();   kbuilder.add(ResourceFactory.newClassPathResource("ruleflow.rf"), ResourceType.DRF);   knowledgebase kbase = kbuilder.newknowledgeBase();  

Knowledge Session

  • Knowledge Base contains a reference to the session. 
  • Whenever we want to start a process, we need to set up a session which is responsible for communication with the process engine.
  • After setting up the session we are able to start the execution of our processes.
  • Whenever a process starts executing, it creates an instance of that process and maintains the state of that process instance.
  • A session can be created many times.
  • Session Creation:

StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();   KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, "test");   // start a new process instance   ksession.startProcess("com.sample.ruleflow");   logger.close(); 

jBPM Services

  • Deployment services: Its main responsibility is to deploy or undeploy units
  • Definition services: scan process definition that parses the process and extracts important information from it.
  1. Process Definition
  2. Process Variable
  3. Service Task
  4. User Task
  5. Input and Output Information
  • Process services: focused on runtime operations so use it only when there is need to alter process instance. 
  1. Start new process instances
  2. Work with existing process
  • Runtime Data services: refers to the runtime information of Process Instances. 
  1. Start Process Instances
  2. Execute Node Instances
  • User Task services: It is used to manage the individual user task from start to end.
  1. Modify Selected Properties
  2. Access to Task Variables
  3. Access to Task Attachments
  4. Access to Task Comments

Process Designer

A web-based designer that allows to model business processes. It also offers a graphical editor to design and edit the business processes including events, activities such as user task, script task, service task, etc. and Gateways such as diverging and converging gateways. We can have this designer as an Eclipse plug-in as well where we can design the business processes.

Process Definition

Process definition is a directed graph made up of nodes and transitions. It is the notation to define business processes and express as an XML schema. The below diagram shows the simple workflow example of a document approval process.

Process: Approval of submitted document

Quick Start with the JBPM

  1. Download the jBPM installer using this link.
  2. Open the bin folder.
  3. Execute the standalone.bat file if you are a Windows user or standalone.sh file for linux users.
  4. Try login to the business central with the default username and password – “wbadmin”.

You will see the above page after successful login to the business central.

  1. Click on the Design option to start designing your business processes. Initially there would not be any space created for your project. You can click on add project to create your own project, or you can try samples project to quick start.
Try samples project of JBPM

Pick a sample project from the repository to start learning more about the business processes.

In this blog, we learned the basic of BPMN using jBPM. I will cover more on how to create custom services within a process, Events, Gateways, Project integration and deployment using CI/CD pipelines.

Linkedin
Business Process Management Developer (Texas, USA)
Master of Science in Computer Science (University of Cincinnati, Ohio, USA)
Former Senior SAP ABAP Developer(Infosys Limited, Pune, India)
Research Paper: https://dl.acm.org/doi/10.1145/2905055.2905333
Microsoft Professional Certified in Database.

Leave a comment