- jBPM5 - Example
- Draw & Validate a Workflow
- jBPM5 - Workflow Components
- jBPM5 - Components
- jBPM5 - Hello World!
- jBPM5 - Eclipse Plugin
- jBPM5 - Overview
- jBPM5 - Home
jBPM5 Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
jBPM5 - Hello World!
Here in this chapter, we will write our first program "Hello World" using jBPM. Follow the steps given below −
Go to File → New → Drools Project −
Cpck Next. Give an appropriate name for the first project : "HelloWorld" in our case.
Cpck Next. Select the bottom two checkboxes, viz −
Add a sample HelloWorld process file to this project
Add a sample class for loading and executing HelloWorld process
Cpck Next. Cpck Configure Workspace Settings (marked red in the following screenshot) −
Cpck the Add button −
Once you cpck the Add button, the following screen appears. Cpck "Create a new Drools5 Runtime"
Give the path till the binaries folder where you have downloaded the
Then, select the Installed Drools Runtimes and cpck OK.
The following screen appears. Cpck the Finish button.
Now, open the Package Explorer view in Ecppse. You will get to see the following screen −
The ProcessTest.java class is the class to load the ruleflow(rf) file and ruleflow.rf is the basic rule flow created for the HelloWorld project.
Double cpck on the ruleflow.rf file and you would see the following ruleflow −
The GREEN circle depicts the start of the workflow, whereas the RED circle is the end of workflow.
The panel depicted on the left-hand side has different components psted which are used in the workflow. Apart from START and END, there are a lot of components which can be used in the workflow and we would be covering them in the next section.
The Hello in between the START and END event is a script task and the name of the script task is Hello. To see what code is written in the script task "Hello", go to Windows → Show View → Other → Properties.
Note − While working on jBPM, please keep the Properties view open at all times because all the configurations are visible in the properties view only.
Cpck the OK button. Now, select Hello and you can see the properties of "Hello" event −
To see the entire code written inside the "Hello" event, select the Action property.
The circle marked in red is the edit of the action property. Once you cpck on Edit −
You can edit this and write the code which you want to execute inside the "Hello" script task. Let us edit it −
Cpck OK. Now open the ProcessTest.java class and run it as a Java Apppcation. Given below is its output −
The terms used in the ProcessTest.java class are the same used for Drools. The point to note in ProcessTest.java class is −
ksession.startProcess("com.sample.ruleflow");
When you write the code for starting the process, the string passed to startProcess method is the id property when we open the workflow.
Advertisements