Get started with jBPM KIE and Drools Workbench – Part 1
source link: http://www.adeveloperdiary.com/bpm/jbpm/get-started-with-jbpm-kie-and-drools-workbench-part-1/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
November 8, 2015 By Abhisek Jana 14 Comments
Get started with jBPM KIE and Drools Workbench – Part 1
jBPM is the open source solution for workflow engine where complex business process can be defined and executed. Drools is the business rules management system (BRMS) based rules engine. KIE (Knowledge Is Everything) is the new name for Drools, jBPM and related technologies.
Often its challenging and time consuming to get started with the Web version of the Workbench. In this series I will talk about how to setup the KIE Workbench, develop and execute simple business processes using guided and DRL rules, which should save you a lot of time.
In this first part we will create a very basic business flow, then deploy and test it. We will then create more complex process in next part.
So let’s get started with jBPM KIE and Drools Workbench.
We will download and install the war file of the KIE workbench in JBOSS Server.
As I am writing this article, the latest version is 6.3, however I am facing a small issue with the wildfly (the new JBOSS) server in my MAC, so I will be using the old JBOSS 7.1.1 server and the 6.2 kie-wb-distribution-wars-6.2.0.Final-jboss-as7.war
file.
Install JBOSS Server:
Download the JBOSS Server, you can try the latest wildfly9/8 server. I had problem while using Process Model with El Capitan, however it worked fine in Windows 7.
Setup Wildfly9/8 or JBOSS 7.1.1:
The new name for the JBOSS Server is Wildfly9/8. Download it from the below link.
Get the JBOSS 7.1.1 from the below URL.
http://jbossas.jboss.org/downloads
Exact URL:
http://download.jboss.org/jbossas/7.1/jboss-as-7.1.1.Final/jboss-as-7.1.1.Final.zip
Extract the zip file. Make sure the path does not have any space in it. Open the /standalone/configuration
folder and rename the standalond.xml
to standalone_old.xml
. Then again rename the standalone-full.xml
to standalone.xml
Now open the /bin
folder and execute the add-user.sh
or add-user.bat
. We need to add two users, one for accessing the admin console of the app server and another for using the KIE Workbench.
At first, lets add the Management User (Option [a]), we will use this id to access the Admin Console. When prompted, enter the user name and password. I have highlighted the data entered by me.
Now add another user, this time enter option b (Application User). When asked, enter role as admin
.
Now start the standalone.sh
or standalone.bat
, your server should be up and running.
Note: In case you are using JBOSS 7.1.1 in MAC and you have JDK version 7 or 8 setup then the server won’t start. There is an issue with JBOSS 7.x server with the JDK 7/8. In order to fix this, you need to set the default JDK to 1.6. In windows this is very easy, you can just change the PATH
variable.
If you already know how to change the default JDK in Mac then skip the following part.
Change the default JDK in Mac:
Add the following in your .bash_profile
file.
Restart the terminal, then you should be able to change the JDK by the command below.
jvm 1.6*
Access the server by using the following URL:
Then Click on Administration Console
, enter the Management User ID (user3 in my case) and related password. You should now see the admin console.
Download the kie-wb-distribution-wars from the below Maven repository. I will be using the 6.2.0. Final version for released in Mar 2015.
http://repo1.maven.org/maven2/org/kie/kie-wb-distribution-wars/
If you are using Wildfly then download the wildfly8 war, however I have downloaded the kie-wb-distribution-wars-6.2.0.Final-jboss-as7.war
file.
Now deploy the war file from the admin console. The URL will be the name of the war file.
http://localhost:8080/kie-wb-distribution-wars-6.2.0.Final-jboss-as7/
KIE Workbench Interface:
Login using the Application User ID (user4 in my case) and related password. The landing page should be as below.
The menu on top also have been expanded in the dashboard. Let’s talk about few of them.
Authoring -> Project Authoring:
This is the most important functionality. All the business process and rules will be created here.
Authoring -> Administration:
You can create the project repository here.
Deploy -> Process Deployments:
You can find all the deployed processes here.
Process Management -> Process Definitions:
The deployed process definitions will be listed here.
Process Management -> Process Instances:
Each process instances will be listed here.
Tasks -> Tasks List
All the tasks assigned to users will be displayed here.
Create Repository:
Let’s start with creating a repository. Go to Authoring -> Administration
. Click on Organizational Units-> Manage Organizational Units
.
Now click on Add, enter the following details and click on Ok.
Then click on Repositories -> New Repository
. Now click on Authoring -> Project Authoring
.Click on demo and select adeveloperdiary from the dropdown.
Create Business Process:
We will now create a sample business process. Click on New Item-> Project
. Enter name as MyProject
, click on Ok
and then click on Finish
. Once you create a project the Project Editor will be opened by default. Remember you can deploy a project from the project editor only.
Now click on New Item->Business Process
, enter Business Process as sample1
and package as adeveloperdiary.myproject
. Click on Ok
.
The process modelling tools will be opened at the right side. We will now create a sample process and test it.
Select the green circle, then you should see the options displayed there.
Click on the square rectangle, that should create a task. Double click on it, then enter Sample
as the name. Select the task and you should see an option icon below it. Click on it and select User Task
. There are different type of task type you can select from the list, we will learn bit more about them later.
Now select the Sample task again and once you move your mouse to the right side icons you can see a circle. Click on it. That should create a red circle, which will indicate end of our process flow.
Now Click on the save icon from the toolbar and click on save.
We need to assign the Sample task to one user since task type is User Task. Click on the Sample Task again and click on the small arrow at the right side, this bring up the property window.
Enter user4 in the Actors
, also Sample Task
as the Task Name
. Click on save.
Our task does not do anything, however let’s execute it.
Click on Open Project Editor
button at the left then click on Build->Build & Deploy
.
Execute and Test:
Click on Process Management-> Process Definitions
. Click on the the start icon in Action
column. Click on Submit from the popup. We didn’t set a name for the process, so the default name evaluation will be displayed. Click on Submit.
Now click on Process Management-> Process Instances
, click on the instance and the right panel should display the details about the Process Instance. Click on Options -> Process Model
.
This is a very important functionality, you can how our business process is getting executed here. The process has been started, it’s waiting on our user task. Let’s complete that.
Click on Tasks-> Tasks List
, you should see the Sample task is waiting for the user4 to complete. Click on the task and the right panel should open. Click on Start, there is nothing much to do here, so click on Complete. Now Go back to Process Instance and you can find the process in Completed Tab since it has already been completed. Click on it and verify the Process Model, you can see all the steps have been grayed our since we have completed our process.
We need to un-deploy the process to make change and deploy again. Click on Deploy-> Process Deployments
and click on the un-deploy
icon from the Action column. Note, if you have any instance running them you need to stop that before you can un-deploy any process.
We went through all the steps here, from creating a business process to deploy and test it. In the next part we will learn how to create more complex process and define rules for each task.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK