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

Checking Out Camunda: Replacing the Old BPMS Legacy System

DZone 's Guide to

Checking Out Camunda: Replacing the Old BPMS Legacy System

Analyzing and replacing the heavyweight old BPMS legacy system with REST based workflow engine, Camunda.

· Open Source Zone ·
Free Resource

Traditional BPM or tightly coupled application although designed in accurate way but over the time due to addition of new functionality and lack of old version product support usually it ends up with the following problems:

  • Heavyweight system that is hard to install and to maintain.
  • Closed architecture, hard to integrate with existing technology stack.
  • Required their proprietary approach to application development, disliked by software developers and limited in flexibility.
  • Lack of support for BPMN, or missing features and tools.
  • Issues with performance and scalability.
  • Difficult to get qualified, affordable professional services.
  • Total Cost of Ownership (TCO) too high, in part due to high maintenance fees.

As a result, only BPMS replacement or redesigned option remains.

Issues With Replacement Approach

While looking at replacement or redesigned approach first thing come in mind is cost and implementation flexibility with modern architecture. How to bind the orchestration engine with micro-service? It should leverage workflow, ordering of activities, handling of timeouts, complex business transactions, or other cool features. In the future, it should be easily replaceable with other orchestration engines.

Other BPM vendors provides the solution but the platform provides plug in, own functionalities and extensions but all this is done in Java.

How Can Camunda Help With the Above Problems?

The Open Source BPM platform Camunda serves these use cases very well. It is easy to run Camunda without any Java knowledge and set up an architecture to code in the language of a particular choice. Camunda can be used as a standalone process engine server or embedded inside custom Java applications. For high availability and scalability, Camunda can run on a distributed cluster while relying on one shared database.

The core advantages of Camunda BPM compared to other BPM solution are the increased flexibility, the usage of standard technologies and knowledge, reduced licensing costs and an accelerated software development process.

  • Introduces the basic architecture and alternative 
  • BPMN modeling
  • Introduces the Camunda REST API,
  • Existing client libraries for languages other than Java,
  • Example using C# and Node.JS
  • describes ways to run a Camunda server (Docker or Tomcat).

Camunda is written in Java and needs a Java Virtual Machine (JVM) to run. Camunda provides a REST API which allows to code in whatever language and just talk REST with Camunda:


REST API

rest API


 

There are below alternatives with which we can build the architecture with workflow engine

  • Asynchronous communication by commands and events (normally using a message or event bus)
  • Point-to-point communication by request/response (often REST)
  • Work distribution by workflow engine

BPMN Modeling

Workflows in Camunda are defined in BPMN which is basically an XML file. It can be graphically modeled using the Camunda Modeler. Camunda supports BPMN 2.0 so it is easy to migrate existing BPMN process from one another BPMN product to Camunda directly with Cawemwo or modeler. 

  • Cawemo is BPMN process specification platform of the Camunda stack. Its main purpose is to enable to stakeholders to model and collaborate on business process diagram.
  • The flow diagram is the bridge between business and technical team which gives the ability to draw business flows minus technical details. 
  • Created BPMN further implement in separate parts by using various multiple nodes which actually build the orchestration. For detail please refer example shown in above diagram

Deploy the Process

Camunda provides REST API to deploy and start the process as follows:

  • One can leverage the REST API to deploy the process model. Create BPMN process file and save it with the name test.bpmn and start Camunda with tomcat or via Docker to have it available on "localhost:8080"
Java
 




xxxxxxxxxx
1



1
curl -w "\n" \
2
-H "Accept: application/json" \
3
-F "deployment-name=trip" \
4
-F "enable-duplicate-filtering=true" \
5
-F "deploy-changed-only=true" \
6
-F "test.bpmn=@trip.bpmn" \
7
"http://localhost:8080/engine-rest/deployment/create"


  • Now with the above API process, it will deploy to start same process refer below REST example.
Java
 




xxxxxxxxxx
1



1
curl \
2
-H "Content-Type: application/json" \
3
-X POST \
4
-d '{"variables":{"someData" : {"value" : "someValue", "type": "String"}},"businessKey" : "12345"}}' \
5
"http://localhost:8080/engine-rest/process-definition/key/testfirstworkflow/start



Client Libraries

Calling REST API is easy from any language. In JavaScript simply use JQuery and in C# you might leverage System.Net.Http and Newtonsoft.Json to do so. We can hide the REST details behind some client library.

Find below the reference of available client libraries in Camunda:

Both initiatives are in an intermediate state and rather inactive but can serve as a good starting point.


Example With C#

C#
 




xxxxxxxxxx
1
32



1
var camunda = new CamundaEngineClient("http://localhost:8080/engine-rest/engine/default/", null, null);
2
 
          
3
// Deploy the BPMN XML file from the resources
4
camunda.RepositoryService.Deploy("trip-booking", new List<object> {
5
       FileParameter.FromManifestResource(Assembly.GetExecutingAssembly(), "FlowingTripBookingSaga.Models.FlowingTripBookingSaga.bpmn") 
6
});
7
 
          
8
Example with Node.js
9
var Workers = require('camunda-worker-node');
10
var workers = Workers('http://localhost:8080/engine-rest', {
11
workerId: 'some-worker-id'
12
});
13
 
          
14
workers.registerWorker('reserve-car', [ 'someData' ], function(context, callback) {
15
var someNewData = context.variables.someData + " - added something";
16
callback(null, {
17
variables: {
18
someNewData: someNewData
19
}
20
});
21
});



Run Camunda on Tomcat

To setup Tomcat and install Camunda into it, following the installation description. This gives the freedom to use whatever Tomcat version you prefer or e.g. install it as a Windows service.

Custom Docker Image With “Camunda standalone WAR”

As an alternative to the pre-built Docker image from Camunda we can also prepare Tomcat yourself extensive additional requirements and are capable of setting up a Java build environment, which can even customize this Camunda standalone war.

The easiest way to run Camunda is using Docker. 

docker image and rest API


The Dockerfiles and some documentation (e.g. how to connect that with the databases choice) is available on Github:

  • One can also build the docker image basing on a proper Tomcat distribution.
Topics:
camunda bpm

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}