Getting started with jBPM Business Central

In this tutorial we will learn how to install the JBPM Business Central (which is the new name for the Drools workbench) and the Kie Execution Server on WildFly so that you have a full blown environment for designing and deploying your Kie assets!

The Business Central Workbench (Drools Workbench) is a web application where we can design and deploy your Kie assets, such as Drool Rules, Processes, and data models. It is an awesome tool to bridge the gap between developers and business people with little technical knowledge of the specifics of implementation into the development cycle, because it provides a user-friendly environment for rule writing.

Business rules, process definition files, and other assets and resources created in Business Central are stored in the Artifact Repository (Knowledge Store) that can be accessed by the Execution Server. If you want to know more about the Kie Execution Server take a look at the following article:

The Knowledge Store is a centralized repository for your business knowledge. It connects multiple git repositories so that you can access them from a single environment while storing different kinds of knowledge and artifacts in different locations. The Business Central provides a web front-end that enables you to view and update the stored content.

Before adding a sample asset to our repository we need some intallation.

Installing the Business Central

You can install the Business Central in two ways:

1) Download the jBPM Server Distribution which includes in the bundle

This is the simplest option and it is recommended if you are starting from scratch. Within the jBPM Server Distribution you’ll get the following components out of the box.
WildFly server

  • Business Central
  • KIE Server
  • jBPM Case Management showcase app
  • jBPM Service repository (with community work items)

In order to download the jBPM Server Distribution, pick up the latest final version at: https://www.jbpm.org/download/download.html

Unzip the distribution, then start the jBPM Server distribution with:

$ ./standalone.sh 

2) Download the Business Central and Kie Server war files

This option requires installing the Business Central, Kie Server and Kie Server Controller on the top of WildFly. Additionally, you will need to add some System Properties to fix the communication between the Business Central and the Kie Server. We have a tutorial which covers this option: Installing the Business Central on WildFly

Creating a Project using the Drools Workbench

Once that you have started WildFly, you can login into the into the Business Central Workbench with one of the available credentials (for example kieserver / kieserver1!) and you will be taken to the main screen:

install business central wildfly drools tutorial

We will now create a Project, add an Asset to it and deploy it to the Kie Server that is available on the same WildFly server.

Go to Menu → Design → Projects in Business Central and click on “Add Project

drools rule engine

Enter the Project name and Description:

drools rule engine

Next, click on Add Asset:

drools workbench

The list of assets you can add will be displayed in the next UI. Select to add a DRL file (a Drools Rule):

drools workbench

Choose a name for the DRL file and a default package:

drools workbench

The content of the Rule will be pretty simple: An Hello message will be printed to the variable “name” passed as attribute to the Rule:

drools workbench

Here is the same Rule, if you want to copy and paste it into the editor:

rule 'hello'
when
    $name: String()
then
    System.out.println("Hello " + $name);
end

Click on Save. You will return to the list of Assets for your Project:

drools workbench

Now Build and Deploy the Rule so that it will be copied into the Knowledge Store.

Return the main screen and click on the Deploy Menu. From there, you will have to create a new Server Configuration which will let you connect to your Assets. Choose a name and the capabilities for your server configuration as shown above and click on Next.

drools workbench

 

In the last screen, you have to enter the Deployment unit GAV. To make it simpler, a list of available assets is displayed in the GAV table so by clicking on Select will populate automatically the UI.

drools workbench

 

That’s all. Click on Finish and the Configuration will be available on your Kie Execution Server:

drools workbench

Testing our simple Rule

Now we can test our simple Rule with any available REST Client. Linux users have the ‘curl’ command available so just create an input file, say ‘hello.json‘ with the following content:

{
      "lookup" : null,
      "commands" : [ {
        "insert" : {
          "object" : "Francesco"
        }

      }, {
        "fire-all-rules" : { }
      } ]
    }

And now invoke the Rule on the Execution Server as follows (please notice the URL is slightly different from the one appearing in the Business Central Deploy UI):

curl -X POST -H 'X-KIE-ContentType: JSON' -H 'Content-type: application/json' -u 'kieserver:kieserver1!' --data @hello.json http://localhost:8080/kie-server/services/ret/server/containers/instances/DemoRule_1.0.0

Conclusion

In this tutorial we have learnt how to install the Drools WorkBench (now known as Business Central ) and the Kie Execution Server on WildFly, then we have created a simple Asset and made it available on a Kie Execution Server Container. We have finally executed the Asset with a minimal shell command.