Giter Club home page Giter Club logo

quarkus-bpmn's Introduction

Quarkus and BPMN Sample for Automatic Loan Approval

An integration of BPMN workflow using Kogito, and Quarkus Framework. This shows BPMN capability to validate and process REST API with a specific JSON format and gives response based on workflow.

Also having the capability to connect BPMN workflow with external existing database thru Quarkus database functionality.

Risk Table

Image

Business Workflow

Image

Build

$ mvn clean package -s settings.xml

Run

$ java -jar .\target\quarkus-app\quarkus-run.jar

Test

$ curl  -X POST http://localhost:8080/customer_risk  \
    -H 'content-type: application/json'  \
    -H 'accept: application/json'   \
    -d '{"name" : "Regular User", "salary":500, "age": 15}'
    
{"id":"c4fcc5eb-9aab-4c99-8620-5ff1c27be79e","name":"Regular User", "risk":"High","salary":500,"age":15,"status":"Loan is Rejected because Customer is High Risk"} 
    

Endpoints

Open http://localhost:8080/q from web browser to see all the BPMN endpoints.

Unit Tests

    @Test
    public void testHighRiskCustomer() {
        given()
                .body("{  \"name\":\"Regular User\", \"age\": 15, \"salary\": 300 }")
                .contentType(ContentType.JSON)
                .when()
                .post("/customer_risk")
                .then()
                .statusCode(201)
                .body("'status'", equalTo("Loan is Rejected because Customer is High Risk"));
    }

Database

    create table t_blacklist
    (
        id int auto_increment,
        name varchar(16) not null,
        constraint t_blacklist_pk
            primary key (id)
    );

Calling Quarkus Script from Inside BPMN

    com.edw.service.BlacklistService blacklistService = new com.edw.service.BlacklistService();
    if(blacklistService.isBlacklist(name)) {
        kcontext.setVariable("blacklist", true);
        kcontext.setVariable("status", "Loan is Rejected because Customer is Blacklisted");
    }    
    else {
        kcontext.setVariable("blacklist", false);
    }

quarkus-bpmn's People

Contributors

edwin avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.