Business rules
Leverage standard JSR-94 rules engine to perform advance business rules
Objective
Enable businesses processes to leverage streaming data using existing business rules assets.
Uses
Rules processing is well understood, mature technology which has many uses across industries.
Presented below are few uses within a streaming context:
In financial services Enable a business to migrate towards a stream-based rules processing model, allowing for real-time risk assessment and compliance monitoring.
In logistics Gain live customer insights using existing rule assets to improve delivery times and optimise route planning based on real-time data.
In retail Implement a system for tracking customer purchasing behaviours, leveraging existing rule assets to provide tailored promotions and enhance customer satisfaction.
Examples & DSL attributes
This snippet will load the Drools rules file, compile and build the internal rules context ready for event based rules processing.
Attributes schema
Current implemented use Redhat Drools Business Rules Management solution v8.44.0.Final which is a JSR-94 standard implementation
Example rules file
This example codifies the below data usage alerting business rules in to a set of Drools rules that are declared with a drl
file.
Drools rules
Low data usage Less than 50% data used and has more than equal to 15 days left.
Medium data usage More than 50% and less than 65% data used and has less than 10 days left.
High data usage More than 90% data used and has less than equal to 5 days left.
To learn more about defining rules go to the Drools rules language documentation.
Whenever a rule condition is triggered the passed event has a RuleResponse
object added, see below for further details.
RuleResponse Object
This object contains custom rule responses that drive further processing within the use case. For the above example we simply added a description of what rule was fired.
The RuleResponse
extends from the HashMap class with an additional ruleId
field. The ruleId
is used to inform further processing which rule was triggered, this is a requirement.
Any number of response attributes can be added to the response object.
The processor manages the creation of the RuleResponse object and the addition to the StreamEvent.
Last updated