jbossdemocentral / brms-loan-realtime-decision-server-demo

This JBoss BRMS demo project will provide you with an example of creating, deploying and leveraging a set of rules (decision table) in a Realtime Decision Server. You will be given examples of calling the rules as if using it from an application with the RestAPI that is exposed.
11 stars 18 forks source link

JBoss BRMS Loan Realtime Decision Server Demo

This demo project will provide you with an example of creating, deploying and leveraging a set of rules (decision table) in a Realtime Decision Server. You will be given examples of calling the rules as if using it from an application with the RestAPI that is exposed.

There are two options for you to install this project: local and Docker.

Software

The following software is required to run this demo:

Option 1 - Install on your machine

  1. Download and unzip.

  2. Add products to installs directory.

  3. Run 'init.sh' or 'init.ps1' file.

  4. Start JBoss BRMS Server by running ./target/jboss-eap-6.4/bin/standalone.sh

  5. Login to http://localhost:8080/business-central

    - login for admin and analyst roles (u:brmsAdmin / p:jbossbrms1!)
  6. Project has simple data model (Loan & Applicant) and single decision table credit score rule set.

  7. Build and deploy version 1.0 of project. Click on "Open Project Editor", and in the project editor click on "Build -> Build and Deploy".

  8. View Authoring -> Artifact repository to see deployed loandemo-1.0.jar artifact.

  9. Open "Execution Servers" perspective via menu Deploy -> Execution Servers

  10. The view shows one registered Decision Server 'local-server-123'. We will provision a container on this server which will serve our loandemo rules project. Click on the '+' sign on the right of the Decision Server and enter the following details in the pop-up:

    • Name: container-loan1.0

    • search button gathers all artifacts available, SELECT loandemo-1.0 to auto-fill rest of fields (group name, artifact id and version)

    • click on OK

  11. The container definition is created, but is not yet started. Click on the "Start" button to start the container instance on the Decision Server.

  12. Click on the container to show additional information about the container.

  13. Using Firefox + RESTClient you can see which server containers are available by:

  14. You can view some more information provided by the RESTful API using GET methods:

  15. A full description of all available RESTful resources and operations exposed by the Decision Server can be found by opening this URL: http://localhost:8080/kie-server/docs

  16. Now to use POST or PUT methods we need to add a header to RESTClient for our requests:

    • in menu Headers -> Custom Header

    • Name: Accept; Value: application/xml

    • Name: Content-Type; Value: application/xml

    • Name: X-KIE-ContentType; Value: xstream

  17. Query the Realtime Decision Server with loan rules by using POST method:

  18. You can change the decision table as desired, redeploy a new version, use the Version Configuration tab of the container definition to manage the container using UPGRADE button to pull the latest version.

    • you need to deploy a new version of the rules, for example version 1.1, then enter 1.1 in version field of container-loan1.0 before hitting UPGRADE button.
  19. For creation or deletion of containers in the RESTful API, you need to use PUT methods, see product documentation User Guide for details.

Option 2 - Run in Docker

The following steps can be used to configure and run the demo in a container

  1. Download and unzip.

  2. Add product installer to installs directory.

  3. Run the 'init-docker.sh' or 'init-docker.ps1' file.

  4. Start the container: docker run -it -p 8080:8080 -p 9990:9990 jbossdemocentral/brms-realtime-decicion-server-demo

  5. Follow instructions from above starting at step 5 replacing localhost with <RH_CONTAINER_HOST> when applicable

Additional information can be found in the jbossdemocentral container developer repository

Notes

You will need some sort of Rest client, such as the RESTClient Firefox extension which is used in this demo (screenshots and videos). After installing RESTClient in Firefox, restart and open it under TOOLS menu.

Supporting Articles

Released versions

See the tagged releases for the following versions of the product:

Digital Sign

Loan Project

Artifact Repo

Deployment View

Kie Server Endpoint

Dev Server

Create Container

Container Details

Start Container

Started Container

Restapi Auth

Restapi Containers

Restapi Loan Container

Restapi Request Header

Restapi Loan Request

Restapi Loan Request Response