jBPM5 Example - jBPM

how to create a project using jBPM5?

Let’s create an example program using jBPM5. Task at the hand uses jBPM for deciding if a passenger boards a flight or a train based on his income.

Steps for creating the project are same as that of "Hello World" project. Open .rf file in the editor, and see the changes as marked in red

hello_world_project

In the above screenshot we have changed ruleflow id (unique) and added a variable income, as we will be deciding the route depending on the income of the passenger.

How to set variable − Select the edit button marked in red.

set_variable

Click the Add button

variable_list

Below screen pops up

screen_pops

Put name as income and type as Integer.

edit_variable

Click OK. You will see the income variable defined now.

variable_defined

Changes to be done in ProcessTest.java class (Class to load and run your process)

process_test

You should first create a MAP, set a value in MAP and pass this value to the startProcess overloaded method. As explained, we have changed the ruleflow id and hence used the same id (vivek.ruleflow) in the startProcess method.

Before running the ProcessTest.java class, create a POJO Passenger.java in the same package as ProcessTest.java

Now run the ProcessTest.java class as a Java Application and see the output −

process_test1

Change the value − params.put("income", 900); and re-run the class and see the change in output.

change_value

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

jBPM Topics