Chapter 6. Hello World Business Rule


Since Red Hat JBoss BPM Suite comes with Red Hat JBoss BRMS integrated, this chapter provides an introduction to how business rules work and integrate into Red Hat JBoss BPM Suite.

You will add a new Business Rule Task to the Hello World process, which will fire a business rule of a particular business rule group.

Note that this is a very simple integration case and in production you may need to use a more advanced concept and techniques. For more information on business rules, see the Red Hat JBoss BPM Suite Development Guide.

6.1. Creating Business Rule

Business rules are defined as when-then statements: when something is true, then something happens. For example, when the person is older than 18, then particular content becomes available. Business rules are stored in DRL files.

To define the helloworldrule business rule in the Hello World project, do the following:

  1. In Project Explorer, select the Loan Application organizational unit, the helloworldrepo repository, the Hello World project, and the default package.
  2. Create the DRL file:

    1. On the perspective menu, click New Item DRL file.
    2. In the Create new DRL file dialog box, define the resource name as helloworldrule and check that the package is set to default.
    3. Click Ok.
  3. In the displayed DRL editor with the helloworldrule.drl file, define the rule:

    rule "helloworldrule"
    ruleflow-group "helloworldgroup"
    
    when
    then
      System.out.println("Hello World!");
    end
    Copy to Clipboard Toggle word wrap

    This rule does not define any when condition, that is, it will always be true when fired (called to execute) and the Hello World! phrase will be printed.

  4. Click Save.
  5. The Save this item prompt is displayed. Enter the Check-in comment and click Save.

6.2. Adding Business Rule Task

A Business Rule Task is a task which fires rules that belong to a certain ruleflow group.

To add a Business Rule Task to your process, do the following:

  1. In Project Explorer, click the arrow next to the organizational unit path.
  2. Expand BUSINESS PROCESSES and select`HelloWorld`.

    Note: If you are creating your project on a fresh installation, the BUSINESS PROCESSES menu is not visible until you click the arrow.

    Figure 6.1. The Hello World organizational unit path

  3. In the displayed Business Process Designer with the Hello World process, expand the Object Library palette with Process Elements. Click the double-arrow button ( 3898 ) in the upper left hand corner of the Business Process Designer tab to do so.
  4. Expand the Tasks menu and drag-and-drop the Business Rule Task to the canvas on the right.

    Adjust flow connections so as to integrate the task into the workflow.

  5. Select the Business Rule Task and define its properties in the Properties panel:

    • Name: BusinessRule
    • Ruleflow Group: helloworldgroup

      The Ruleflow Group property defines the group of rules that should be fired when the task is being executed. In this example, only one rule, the helloworldrule rule defined in the helloworldrule.drl file, is present in the helloworldgroup group.

    Figure 6.2. The Hello World Process with the Business Rule Task and Its Properties

  6. Click the save button to save the changes.

6.3. Building and Deploying

Build the project and deploy it to the Execution Server:

  1. On the main menu of Business Central, click Authoring Project Authoring.
  2. In the Project Explorer, locate the Hello World project.
  3. Open the project in the Project Editor: in Project Explorer, click Open Project Editor.
  4. Set Version to 1.0.1.
  5. Click Save and confirm the dialogue to save your changes.
  6. Check that the correct project details are displayed on the project screen and click Build Build & Deploy in the upper right hand corner of the project screen view.

A green notification appears in the upper part of the screen informing you that the project has been built and deployed to the Execution Server and is available for instantiation.

6.4. Instantiating Business Process

To create an instance of the Hello World process, do the following:

  1. Click Process Management Process Definitions on the main menu.
  2. On the displayed Process Definitions tab, locate the new Hello World process definition, that is org.bpms:HelloWorld:1.0.1. If it is not available, click Refresh to have the process definition displayed.
  3. Click the Start ( start button ) next to the process definition entry and in the dialog box, click Submit to confirm that you want to instantiate the process.

    The process is instantiated with the currently logged-in user as the process owner and the process form is displayed. When you define the form for your business process, it serves to request input from a user during process instantiation. For further information, see the Red Hat JBoss BPM Suite User Guide.

The Process Instance Details view is displayed with details about the started process instance. The Hello World! message appears in standard output twice, typically the terminal emulator in which the server was started. Then the process instance waits on the Timer Event.

Click Options Process Model to see the current execution status.

Figure 6.3. Hello World Realtime Execution Diagram: the Timer Event Being Executed

Back to top
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2025 Red Hat