Lab Overview
You will create a BPMN process that will orchestrate 1 DMN decision and 1 DRL RuleUnit.- Get Driver information (could be from a Database)
- Validate the driver’s license based on expiration date
- If valid, we’ll check if the driver’s license should be suspended based on the Traffic Violation

Supporting Files
The Java services provided in the repository https://github.com/aletyx-labs/kie-10.0.0-lab-rules-orchestration contain the infrastructure to support this process. Below is a brief description of each file:Driver.java
Represents a driver entity with personal details and license status.- Attributes include
id,name,state,city,points,age, andlicenseExpiration. - Tracks whether the driver has a valid license (
validLicense). - Includes getter and setter methods for all attributes.
DriverService.java
Service responsible for retrieving driver information.getDriver(driverId): Retrieves driver details, potentially from an external service or database.- Mocks driver data, including randomly determining license expiration based on the driver’s ID. This could be a database access to retrieve such information.
Fine.java
Represents a traffic fine with associated penalties.- Attributes:
amount: Monetary fine imposed.points: The number of penalty points added to the driver’s record.
- Includes getter and setter methods.
LicenseValidationService.java
RuleUnitData that provides single driver for validation using rule-based decision-making.- Uses
SingletonStore<Driver>to manage a single driver’s data. - Provides methods to set and retrieve driver data.
- Includes
getCurrentTime()to return the current timestamp.
Violation.java
Represents a traffic violation event.- Attributes:
code: Unique identifier for the violation.date: Date when the violation occurred.type: Type of violation (e.g., speeding).speedLimit: Allowed speed for the road.actualSpeed: Speed at which the driver was caught.
- Includes a constructor and getter/setter methods.
LicenseValidationService.drl
File that provides all Rules for LicenseValidationService unit. In this case there’re two simple rules that validates the driver’s license based on expiration date.driver and currentTime are provided by LicenseValidationService unit.
TrafficViolation.dmn
Decision that evaluates if a driver should be suspended or not. It takes the Driver and a Violation as input data, evaluates the fine for the violation and using the result of the Fine decision, defines if the Driver should be suspended or not.Instructions
Step 1: Clone the Repository
Clone the lab project from this repository, which contains all the necessary files and infrastructure for the lab.Step 2: Import the Project
Import the project into VS Code and explore the provided Java classes.Step 3: Create the BPMN file
Create a new file name traffic.bpmn under src/main/resources and open it using the Apache KIE BPMN Editor. Once file is created, create the process variables that we’ll need.Step 4: Create the process diagram
Our goal is to orchestrate the DRLs and the DMN, we’ll load Driver content based on it, evaluate the license with DRL and then we’ll run the DMN. In general this is the nodes you’ll have to create:- Start Event: Initiates the traffic rules orchestration process.
-
Get Driver Details Service Task
Interface: ai.aletyx.kie.workshop.rules.orchestration.DriverService
Operation: getDriver
Variables - Input Mapping:
Variables - Output Mapping:
-
LicenseValidation with DRL Business Rules Task
Rule Language: DRL
Rule Flow Group: unit:ai.aletyx.kie.workshop.rules.orchestration.LicenseValidationService
Variables - Input Mapping:
Variables - Output Mapping:
-
Exclusive Gateway: We’ll check if the Service was successful or not.
-
On Fail
4.1. End event
-
On Success
4.2. TrafficViolation DMN Business Rules Task Rule Language: DMN Namespace: https://github.com/kiegroup/drools/kie-dmn/_A4BCA8B8-CF08-433F-93B2-A2598F19ECFF Decision Name: Traffic Violation DMN Model Name: Traffic Violation Variables - Input Mapping:Variables - Output Mapping:4.3. Script Task Script:4.4. End Event
-
On Fail