Monday, May 4, 2015

JBoss BPM Suite Quick Guide - Getting Started with the Realtime Decision Server

(This article is a cross post excerpt from article authored by Jey Paulraj, Senior Solution Architect at Red Hat in North America)

The latest release of the JBoss BPM Suite 6.1*, has quite a few improvements within the rules, events, planning and processes, but with so many updates to talk about we thought it might be nice to introduce topics of interest to you individually.

This article will feature a look at the Realtime Decision Server component, an out of the box feature which provides a unified platform to execute business rules.

Rule Execution Server architecture.

With most rule projects, you not only need to write the rules, but also execution code (tests at the very least) to ensure the rules are being used in your application. This was a tighter integration with the rules and the developer of the application.

This is no longer necessary with the Realtime Decision Server, as we can now have rule owners creating rules in the provided tooling, building the resulting rule project from JBoss BPM Suite business central and deploying the rule project into an execution container automatically deployed onto our JBoss BPM Suite server.

The provided execution container is a self-contained environment that is provisioned to hold an instance of the compiled rule package and deployed rule instance. We are then provided with rule execution operations which are exposed in a RestAPI, so that any application can consume the deployed rules seamlessly.

This is a clean separation of rule development and application code development within a JBoss BPM Suite project.

Background

The Realtime Decision Server is distributed as a web application archive (WAR), look for the file named kie-server.war, as part of both the JBoss BRMS and JBoss BPM Suite 6.1 releases and is found in the server deployments directory.

To access the execution server functionality, that is being able to deploy an execution server with your rules, your user will need to have the role kie-server. This role needs to be added into the application-roles.properties file which can be found on the JBoss BPM Suite server at:

jboss-eap-x/standalone/configuration/application-roles.properties

If you are using any of the JBoss Demo Central hosted JBoss BRMS or JBoss BPM Suite demo projects, then you will find that this role has been added to the default setup of these projects.

To summarize, for using the Rule Execution Server you need to do the following:
  • deploymentkie-server.war into JBoss BPM Suite deployment folder
  • user role – add role kie-server to JBoss BPM Suite server configuration in application-roles.properties

The project

To make this as easy as possible for you to get started, we have put together a complete and easy to use Realtime Decision Server demo project. In this project you will find a step-by-step description that helps you to make use of your very own Realtime Decision Server.

To setup the project you just follow these simple instructions:

  1. Download and unzip.
  2. Add products to installs directory.
  3. Run 'init.sh' or 'init.bat' file.
  4. Start JBoss 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:erics / p:jbossbrms1!)

Now you can note if the Realtime Decision Server is running at:


To make use of the Realtime Decision Server you will need a rule based project to deploy and this is a quick outline describing how you will get started.
  • us the provided rule project or create a new project in business central
  • create a model or import existing model
  • create simple rule using the model that you have created
  • build and deploy your project

Realtime Decision Server

The following outline walks you through the process of deploying your rule project into a rule execution server so that applications can consume the provided RestAPI.

DevServer created.
It is based on the Realtime Decision Server demo project from JBoss Demo Central.
  • select Deploy -> Rule Deployments from business-central 
  • click Register to register your server and key in the following server information
    • Endpoint: http://localhost:8080/kie-server/services/rest/server/
    • Name: DevServer
    • Username:  erics
    • Creating a container.
    • Password: jbossbrms1!
  • click connect, your server should be created
  • click + symbol at right most corner on your server
  • you’ll get a pop-up screen to create container for your rule project
    • Name: container-loan1.0
    • groupid - artifactId - version
      • you search search business central if you can't remember this information, click select button to import automatically from found item
  • container created for your rule project and exposed as a REST service that can be consumed from your application
  • select the server DevServer and click on Start in the top right corner
Container created and started.
You can now access this project to test with any REST client.

In our Realtime Decision Server demo project we walk you through the Firefox browser RESTClient extension usage, but it is easy enough to replicate with other clients like SoapUI.

You can also view the endpoint as shown in your server which is in my case: 

http://localhost:8080/kie-server/services/rest/server/containers/container-loan1.0

The output in our case was:

<response type="SUCCESS" msg="Info for container container-loan1.0">
     <kie-container container-id="container-loan1.0" status="STARTED">
           <release-id>
               <artifact-id>loandemo</artifact-id>
               <group-id>com.redhat.demos</group-id>
               <version>1.0</version>
           </release-id>
           <resolved-release-id>
               <artifact-id>loandemo</artifact-id>
               <group-id>com.redhat.demos</group-id>
               <version>1.0</version>
           </resolved-release-id>
           <scanner status="DISPOSED"/>
     </kie-container>
</response>

With a proper XML request you can access the rule packages you expose in this manner from your applications over REST.

Looking to Automate your business?
See the detailed instructions in the Realtime Decision Server demo project for exactly how to interact with the rules deployed on your server.


(*The Realtime Decision Server can be deployed along with the entire JBoss BPM Suite or with the JBoss BRMS product. While we reference only JBoss BPM Suite in this article, it can be taken to mean either product.)