This project aims to demonstrate how to add process orchestration to an existing application. By following this README and the accompanying materials, the goal is to:
- create a greater understanding of process orchestration
- how to model processes with BPMN
- how to connect your process to an existing application.
The goal, in other words, is for the process engine handles the state of your process while your application continues to manage the data. The goal is to have each step of the process not have any knowledge or requirement of what the next step in the process in: they handle the task given to them, and the process engine moves to the next step.
To interact with the API, you will need an API client like Bruno or Postman.
To automate the process, you will need a free Camunda account. Sign up for your free account at https://camunda.io/.
Knowledge of basic BPMN modeling is needed. Camunda Academy has a wonderful set of training videos to get you started with BPMN. At a minimum, you need to understand:
- start and end events
- service tasks
- user tasks
- gateways (XOR)
To run this project, you either need Java 21+ installed and/or Docker.
The included DOCKERFILE
will build and start the application. First you need to build
the image:
docker build --tag "camunda-loan-demo" .
After the image is build, you can run it:
docker run -p 8080:8080 -d camunda-loan-demo
By using the -p 8080:8080
argument, Docker forwards port 8080 to the container. You will be
able to connect to the API using http://localhost:8080
.
With Java 21+ installed, run:
./mvnw spring-boot:run
The application is extremely simple and does not have much business logic. It is meant to provide the feeling of a production application without the need to spend time learning how the application functions first.
Using the CQRS pattern, the application mimics an event-driven application that accepts a loan application form from an end user (applicant), then moves the loan through a series of validations and checks before either rejecting or approving the loan. The steps are outlined in the PROCESS REQUIREMENTS document.
To understand what API's are available, two collections are provided. One is for Bruno, an open source API Client; the other is for Postman. Import the collection for whichever API client/manager you prefer.
- Bruno: bruno-collection.json
- Postman: postman-collection.json
Using your API client, send a POST request to the /api/loanApplications
endpoint with the
following body:
{
"givenName": "James",
"surname": "Holden",
"address": "123 Main St.",
"city": "Windmills",
"stateOrProvince": "Montana",
"country": "USA",
"postalCode": "59354",
"type": "HOME",
"amount": 220000
}
The application mimics a process that has many steps, some which require human interaction, so the response can take 15 seconds. Give it some time to process, and you should get a response.
Following the requirements outlined in the PROCESS REQUIREMENTS, craft an executable BPMN model that eliminates the need for CQRS within the application, integrate the service tasks with the API, and, optionally, create a DMN table to automate some of the simple rules (for instance, basic rejection based on credit score).
- Craft a BPMN model using Camunda Web Modeler that fulfills the PROCESS REQUIREMENTS
- Configure the service tasks to call the API using the REST Connector
- Implement forms for the tasks that require humans (for instance, signing the loan paperwork)
- Optionally, implement a DMN table that moves some simple rules into the model (for instance, home loans greater than $450,000 are rejected)
- Optionally, explore using a job worker instead of a Connector
This demonstration was originally given as a workshop at SCaLE 21x in Pasadena, CA, on March 15, 2024. Slides for the workshop can be found here.
Interested in having this presented as a workshop to your company or conference? Let the Camunda Developer Relations know by emailing us at [email protected]!
There are many features that could be added and improved in this demonstration. Some ideas:
- simple front-end that shows the forms
- branch with a completed model and cleaned up code
- branch using job workers with a completed model and cleaned up code
- example custom Connector that extends the REST Connector