Skip to content

Minimal loan origination application to demonstrate process orchestration

Notifications You must be signed in to change notification settings

camunda-community-hub/devrel-loan-demo

Repository files navigation

Community Extension Compatible with: Camunda 8

Camunda Loan Origination Demonstration

Goals

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.

Requirements

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.

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.

Java

With Java 21+ installed, run:

./mvnw spring-boot:run

Application Overview

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.

Test a loan request

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.

The Challenge

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).

Steps

  1. Craft a BPMN model using Camunda Web Modeler that fulfills the PROCESS REQUIREMENTS
  2. Configure the service tasks to call the API using the REST Connector
  3. Implement forms for the tasks that require humans (for instance, signing the loan paperwork)
  4. Optionally, implement a DMN table that moves some simple rules into the model (for instance, home loans greater than $450,000 are rejected)
  5. Optionally, explore using a job worker instead of a Connector

Workshop

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 community@camunda.com!

TODO

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

About

Minimal loan origination application to demonstrate process orchestration

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published