Liferay with jBPM Workflow Integration – Complete Guide

 

Introduction

Enterprises often use Liferay as a powerful portal and content management platform, while jBPM serves as a robust workflow and business process management (BPM) engine.
When integrated together, Liferay can act as the front-end portal and jBPM as the workflow engine, enabling approval flows, case management, decision automation, and business orchestration.

In this blog, we will explore:

  • Why integrate Liferay with jBPM

  • Architecture overview

  • Integration approaches

  • Sample use cases

  • Step-by-step integration outline

  • Best practices


Why Integrate Liferay with jBPM?

Liferay handles UI, portals, users, roles, permissions, and content, while jBPM handles process logic, workflows, rules, and decisions.

Key Benefits

  • Separation of concerns: UI in Liferay, workflow in jBPM

  • BPMN 2.0 based workflows

  • Flexible REST integration

  • Decision automation using DMN

  • Scalable and loosely coupled architecture


High-Level Architecture


Flow

  1. User performs an action in Liferay (e.g., submits a form).

  2. Liferay calls jBPM REST API to start a process.

  3. jBPM executes BPMN workflow.

  4. Human tasks are created in jBPM.

  5. Liferay fetches and displays tasks.

  6. User completes tasks from Liferay UI.


Integration Approaches

1. REST API Integration (Recommended)

jBPM exposes REST endpoints via KIE Server.

Common APIs:

  • Start process

    POST /kie-server/services/rest/server/containers/{containerId}/processes/{processId}/instances
  • Get tasks

    GET /kie-server/services/rest/server/queries/tasks/instances/pot-owners/{userId}
  • Complete task

    PUT /kie-server/services/rest/server/containers/{containerId}/tasks/{taskId}/states/completed

2. Java Client Integration

Use kie-server-client libraries inside a Liferay service module.

Pros:

  • Type-safe

  • Easier payload handling

Cons:

  • Tighter coupling

  • Version compatibility issues


3. Messaging (Kafka / JMS) – Advanced

Use asynchronous integration for high throughput workflows.


Sample Use Case – Leave Approval Workflow

BPMN Flow in jBPM

Start → Submit Request → Manager Approval → HR Approval → End

Liferay UI Flow

  1. Employee submits leave request from Liferay form.

  2. Liferay starts jBPM process.

  3. Manager sees approval task in Liferay dashboard.

  4. Manager approves/rejects.

  5. HR gets final approval task.


Step-by-Step Integration Outline

Step 1: Setup jBPM KIE Server

  • Install jBPM (WildFly / Spring Boot)

  • Deploy BPMN process

  • Expose KIE Server REST


Step 2: Create Liferay Service Module

Use Liferay DXP 7.x with a service module.

Add REST client dependency:

<dependency> <groupId>org.kie.server</groupId> <artifactId>kie-server-client</artifactId> <version>7.74.1.Final</version> </dependency>

Step 3: Call jBPM REST API from Liferay

public void startProcess() throws Exception { String url = "http://localhost:8080/kie-server/services/rest/server/containers/MyContainer/processes/myProcess/instances"; HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/json"); conn.setRequestProperty("Authorization", "Basic " + Base64.getEncoder().encodeToString("user:password".getBytes())); conn.setDoOutput(true); String payload = "{\"employee\":\"Shikha\",\"days\":3}"; conn.getOutputStream().write(payload.getBytes()); }

Step 4: Fetch Human Tasks

public String getTasks(String userId) throws Exception { String url = "http://localhost:8080/kie-server/services/rest/server/queries/tasks/instances/pot-owners/" + userId; HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection(); conn.setRequestMethod("GET"); conn.setRequestProperty("Authorization", "Basic " + Base64.getEncoder().encodeToString("user:password".getBytes())); return new BufferedReader(new InputStreamReader(conn.getInputStream())) .lines().collect(Collectors.joining()); }

Step 5: Complete Task

public void completeTask(long taskId) throws Exception { String url = "http://localhost:8080/kie-server/services/rest/server/containers/MyContainer/tasks/" + taskId + "/states/completed"; HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection(); conn.setRequestMethod("PUT"); conn.setRequestProperty("Authorization", "Basic " + Base64.getEncoder().encodeToString("user:password".getBytes())); }

Security Considerations

  • Use HTTPS

  • OAuth2 / Token-based authentication

  • Role mapping between Liferay users and jBPM users

  • Secure REST credentials


Best Practices

  • Use REST over direct Java coupling

  • Externalize KIE Server credentials

  • Cache task lists for performance

  • Use DMN for decisions

  • Add retry logic for REST failures

  • Use correlation keys


Common Challenges

IssueSolution
User mapping mismatchSync users or SSO
REST authentication errorsValidate credentials
Task visibility issuesAssign correct roles
Payload serializationMatch BPMN variable names
Version conflictsAlign jBPM and client versions

Conclusion

Integrating Liferay with jBPM enables a powerful, scalable enterprise workflow platform.
Liferay delivers the user experience, while jBPM handles orchestration, rules, and approvals.

This architecture is ideal for:

  • HR workflows

  • Case management

  • Approval systems

  • Decision-driven processes


Want More BPM Content?

If you found this useful, explore more BPM tutorials at:
https://shikhanirankari.blogspot.com

And subscribe to Learn IT with Shikha on YouTube for step-by-step BPM, jBPM, and Camunda tutorials.

💼 Professional Support Available

If you are facing issues in real projects related to enterprise backend development or workflow automation, I provide paid consulting, production debugging, project support, and focused trainings.

Technologies covered include Java, Spring Boot, PL/SQL, CMS, Azure, and workflow automation (jBPM, Camunda BPM, RHPAM).


Comments

Popular posts from this blog

Scopes of Signal in jBPM

OOPs Concepts in Java | English | Object Oriented Programming Explained

jBPM Installation Guide: Step by Step Setup