3.7. Defining KIE Bases and Sessions

A KIE base is a repository of the application’s knowledge definitions. It contains rules, processes, functions, and type models. A KIE base does not contain runtime data, instead sessions are created from the KIE base into which data can be inserted and process instances started.

A KIE session stores runtime data created from a KIE base. See the KIE Sessions chapter of the Red Hat JBoss BPM Suite Development Guide for more information.

You can create KIE bases and sessions by editing the kmodule.xml project descriptor file of your project.You can do so through Business Central or by editing kmodule.xml in the src/main/resources/META-INF/ folder by navigating through the Repository view.

Defining KIE Bases and Sessions in the Project Editor

To define a KIE base or session in Business Central, do the following:

  1. Click AuthoringProject Authoring and navigate to your project.
  2. In the Project Explorer window, click Open Project Editor.
  3. Click Project Settings: Project General SettingsKnowledge bases and sessions. This view provides a user interface for changing kmodule.xml.
  4. Click Add to define and add your bases.

    1. After you enter a name for your Knowledge Base, add Packages. For including all packages, click Add below Packages and enter asterisk *.
  5. Below Knowledge Sessions, click Add and enter the name of your session.
  6. Mark it Default and select appropriate state.

    For Red Hat JBoss BRMS, you can choose between stateful and stateless sessions. Use stateless if you do not need iterative invocations of the facts. Otherwise, use stateful session.

  7. Click Save in the top right corner once you are done.

Defining KIE Bases and Sessions in kmodule.xml

To define a KIE base or session by editing kmodule.xml, do the following:

  1. Open the repository view for your project.

    Figure 3.4. Changing to Repository View

    5191
  2. Navigate to /src/main/resources/META-INF . Click on kmodule.xml to edit the file directly.
  3. Define your kbases and ksessions. For example:

    <kmodule xmlns="http://www.drools.org/xsd/kmodule" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <kbase name="myBase" default="true" eventProcessingMode="stream" equalsBehavior="identity" packages="*">
        <ksession name="mySession" type="stateless" default="true" clockType="realtime"/>
      </kbase>
    </kmodule>
  4. Click save in the top right corner.

You can switch between the Project Editor view and the Repository view to look at the changes you make in each view. To do so, close and reopen the view each time a change is made.