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 containerized.
-
Add products to installs directory.
-
Run 'init.sh' or 'init.bat' file. 'init.bat' must be run with Administrative privileges.
-
Start JBoss BRMS Server by running ./target/jboss-eap-6.4/bin/standalone.sh
-
Login to http://localhost:8080/business-central
- login for admin and analyst roles (u:erics / p:jbossbrms1!)
-
Project has simple data model (Loan & Applicant) and single decision table credit score rule set.
-
Build and deploy version 1.0 of project.
-
View Authoring -> Artifact repository to see deployed loandemo-1.0.jar artifact.
-
Open rule deployments perspective via menu Deploy -> Rules Deployments
-
Register a new server by filling in pop-up:
-
Endpoint: http://localhost:8080/kie-server/services/rest/server/
-
Name: DevServer (...as we are testing this in our dev environment)
-
Username: erics (...who must have role of kie-server)
-
Password: jbossbrms1!
- Provision starts by creating a Container, click on DevServer '+' on right.
-
Name: container-loan1.0
-
search button gathers all artifacts available, SELECT loandemo-1.0 to auto-fill rest of fields
-
click on OK
-
Container is created, click on icon far right to view details.
-
Select container-loan1.0 and click START to get it up and running, was orange color next to name, should turn green.
-
See 'Resolved Release Id' section for the container and version that is running and ready for rule queries.
-
Using Firefox + RESTClient you can see which server containers are available by:
-
Add auth credentials in menu Authentication - Basic Authentication: Username: erics Password: jbossbrms1!
-
Method: GET
-
URL: http://localhost:8080/kie-server/services/rest/server/containers
-
it will show container = contianer-loan1.0, meaning our container is available via the provided RestAPI
- You can view some more information provided by the RestAPI using GET methods:
- Now to use POST or PUT methods we need to add a header to RESTClient for our requests:
-
in menu Headers -> Custom Header
-
Name: Content-Type
-
Value: application/xml
- Query the Realtime Decision Server with loan rules by using POST method:
-
http://localhost:8080/kie-server/services/rest/server/containers/container-loan1.0
-
body of message can be found in support/loan-query.xml file, copy into Body section of RESTClient.
-
note you can adjust the credit score field in the xml message body to show rows in decision table being used.
- You can change the decision table as desired, redeploy a new version, use the Server Management Browser 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.
- For creation or deletion of containers in the RestAPI, you need to use PUT methods, see product documentation User Guide for details.
The following steps can be used to configure and run the demo in a container
-
Add product installer to installs directory.
-
Copy contents of support/docker directory to the project root.
-
Build demo image.
docker build -t jbossdemocentral/brms-realtime-decicion-server-demo .
-
Start demo container.
docker run -it -p 8080:8080 -p 9990:9990 jbossdemocentral/brms-realtime-decicion-server-demo
-
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
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.
See the tagged releases for the following versions of the product:
-
v1.1 JBoss BRMS 6.1 with demo rule project to deploy as Realtime Decision Server and Red Hat Container install option.
-
v1.0 JBoss BRMS 6.1 with demo rule project to deploy as Realtime Decision Server