2.2. Executing Your First Process
To execute your process, right-click on
RuleFlowTest.java and select , followed by .
When the process executes, the following output will appear in the Console window:
Hello World
Hello World
Look at the code of
RuleFlowTest class:
As you can see, the execution process is made up of a number of steps:
- Firstly, a knowledge base is created. A knowledge base contains all the knowledge (such as words, processes, rules, and so forth) that are needed by your application. This knowledge base is usually created once, and then reused multiple times. In this case, the knowledge base consists of the sample process only.
- Next, a session for interaction with the engine is generated.A logger is then added to the session. This records all execution events and make it easier for you to visualize what is happening.
- Finally, you can start a new instance of the process by invoking the
startProcess(String processId)method on the session. When you do this, your process instance begins to run, resulting in the executions of the Start node, the Action node, and the End node in order. When they finish the process instance will conclude.
Because you added a logger to the session, you can review what happened by looking at the audit log:
Select the Audit View tab on the bottom right of the window, (next to the Console tab.)
Click on the button (the first one on the right) and navigate to the newly created
test.log file (in your project directory.)
Note
If you are not sure where this
project directory is located, right-click on it and you will find the location listed in the Resource section
A tree view will appear. This shows the events that occurred at run-time. Events that were executed as the direct result of another event are shown as the children of that event.
This log shows that after starting the process, the Start node, the Action node and the End node were triggered, in that order, after which the process instance was completed.
You can now start to experiment by designing your own process by modifying the example. To validate your processes, click on the button (this is the green check box action in the upper tool-bar that appears when you are editing a process.) Processes are also automatically validated when you save them. You can see the debugging information in the Error View.