How to set up Decision Server in JBoss BRMS 6.2?

Solution Verified - Updated -

Environment

  • Red Hat JBoss BxMS
    • 6.2.x

Issue

  • Decision Server has been apparently changed between 6.1 and 6.2. The same procedures which were used in 6.1 does not work now and documentation seems to be relevant only for 6.1. How to register Decision Server and Containers in 6.2 ?
  • When trying to execute rules on a remote server via kie-server, but not able to access remote rules.Need help configuring kieServer to execute rules remotely
  • How can I execute rules with Rest API when I have an existing project in BRMS?

Resolution

As correctly pointed out, the Decision Server has been significantly upgraded between 6.1 and 6.2. It is now unified execution server, which can handle both, rule and process execution. The biggest difference when it comes to the basic operation such as registering the server itself, is that now, it is required to correctly configure it via System Properties - this was not necessary in 6.1 so the same procedure simply won't work.
These System Properties are described in the official documentation. This KCS will illustrate on a simple example:
  • How to register Decision Server
  • How to add new Container to the Decision Server
  • How to remotely execute rules deployed in a Container
As already mentioned, the most important part are the correct System Properties, here is the example configuration which can be just copied into the standalone.xml (or any other place which configures System Properties in a different Application Server):
         <property name="org.kie.server.user" value="anton"></property>
         <property name="org.kie.server.pwd" value="password1!"></property>
         <property name="org.kie.server.location" value="http://localhost:8080/kie-server/services/rest/server"></property>
         <property name="org.kie.server.controller" value="http://localhost:8080/business-central/rest/controller"></property>
         <property name="org.kie.server.controller.user" value="kieserver"></property>
         <property name="org.kie.server.controller.pwd" value="kieserver1!"></property>
         <property name="org.jbpm.server.ext.disabled" value="true"></property>
         <property name="org.kie.server.id" value="local-server-123"></property>
There are couple of rules which needs to be met:
org.kie.server.user needs to have kie-server role assigned (for example in an application-roles.properties file in JBoss EAP)
org.kie.server.location can point to a different host, but for testing purposes we can use same server for both, Controller and Server. Note that this is not suitable for production, as it means once this machine will be down, both Controller and Decision Server will be unavailable.
org.kie.server.controller.user currently this user is hardcoded to kieserver value due to this bugzilla.
org.kie.server.controller.pwd similarly to the controller user, this is a hardcoded value and can't be changed for now. It is covered by the same bugzilla as mentioned above. Note that it is not necessary to use Controller at all - this is just for our convenience, because it gives us the GUI for managing the Decision Server. If GUI is not required, then all of the operation can be achieve by direct usage of REST API. org.jbpm.server.ext.disabled this is not required property, just to demonstrate that the process execution capabilities can be turned off like this.
org.kie.server.id This is too, not required property. If it is omitted then the BxMS will generate unique ID on its own, but usually this is some long, random value, not easily memorable. Because of the bug mentioned in "org.kie.server.controller.user", please create a user "kieserver" beforehand.
$ ./add-user.sh -a --user kieserver --password kieserver1! --role kie-server
Once this configuration is in place, let's start the BxMS. Following should be present in the logs:
08:12:56,038 INFO  [org.kie.server.controller.impl.KieServerControllerImpl] (http-/127.0.0.1:8080-4) Server http://localhost:8080/kie-server/services/rest/server connected to controller
08:12:56,043 INFO  [org.kie.server.controller.rest.RestKieServerControllerImpl] (http-/127.0.0.1:8080-4) Server with id 'local-server-123' connected
08:12:56,062 INFO  [org.kie.server.services.impl.controller.ControllerConnectRunnable] (KieServer-ControllerConnect) Connected to controller, quiting connector thread
08:12:56,063 INFO  [org.kie.server.services.impl.ContainerManager] (EJB default - 5) About to install containers '[]' on kie server 'KieServer{id='local-server-123'name='local-server-123'version='6.3.0.Final-redhat-5'location='http://localhost:8080/kie-server/services/rest/server'}'
Additional ways which allows to verify that the Decision Server was registered correctly are these:
  • Navigate to Deploy -> Rule Deployments - the local-server-123 should be there, similarly as in this picture
  • Send GET request to the following endpoint http://localhost:8080/kie-server/services/rest/server/ response should look like this:
<response type="SUCCESS" msg="Kie Server info">
<kie-server-info>
<capabilities>KieServer</capabilities>
<capabilities>BRM</capabilities>
<location>
http://localhost:8080/kie-server/services/rest/server
</location>
<name>local-server-123</name>
<id>local-server-123</id>
<version>6.3.0.Final-redhat-5</version>
</kie-server-info>
</response>
Once the Decision Server is registered we may add some Containers to id. These Containers are bound to a built KJARs, which includes our business assets - in this example rules. Click on the "+" icon on the line with Decision Server and register new Container - it is necessary to pick the groupid:artifactid:version of the KJAR and also select some name of the Container - this name will be used later on in the interaction with the Container. Once the Container is registered, click the left side circle of the Container to select it. Then click "Start" on the right side. Once the Container is started, we can verify that this operation was successful by sending GET request to following endpoints:
Request: GET http://localhost:8080/kie-server/services/rest/server/containers/
Response:
<response type="SUCCESS" msg="List of created containers">
<kie-containers>
<kie-container container-id="InOutContainer" status="STARTED">
<release-id>
<artifact-id>InOutProject</artifact-id>
<group-id>org.redhat.gss</group-id>
<version>1.3</version>
</release-id>
<resolved-release-id>
<artifact-id>InOutProject</artifact-id>
<group-id>org.redhat.gss</group-id>
<version>1.3</version>
</resolved-release-id>
<scanner status="DISPOSED"/>
</kie-container>
</kie-containers>
</response>
The above will list all the containers, while this request:
Request: GET http://localhost:8080/kie-server/services/rest/server/containers/InOutContainer
Response:
<response type="SUCCESS" msg="Info for container InOutContainer">
<kie-container container-id="InOutContainer" status="STARTED">
<release-id>
<artifact-id>InOutProject</artifact-id>
<group-id>org.redhat.gss</group-id>
<version>1.3</version>
</release-id>
<resolved-release-id>
<artifact-id>InOutProject</artifact-id>
<group-id>org.redhat.gss</group-id>
<version>1.3</version>
</resolved-release-id>
<scanner status="DISPOSED"/>
</kie-container>
</response>
Returns details for a specific container. So far, we have registered Decision Server, add a Container to it, so the last part is the actual rule execution. It is possible to interact with a specific Container via REST API. Follow this KCS to see how to generate and send REST requests to the Container.

NOTE

Once you configured this Managed setup, don't create a Container via Kie Server REST API (Executing Container is no problem) because creating Container is Controller (= business-central)'s responsibility. If you do that, the created Container is not recognized by Controller.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.