SlideShare a Scribd company logo
www.synerzip.com
JBOSS DROOLS
RULE ENGINE
Anil Allewar
1
Agenda
2
1. Introduction to Knowledge based Rule Engine
2. Basics of Drools rules
3. Drools Operators
4. Drools Conditional Elements
5. The problem - Fire Alarm Management System
6. Drools Demo
7. How to control execution of rules - timers
8. Drools integration into Java - using knowledge agent,
changeset
9. Introduction to decision tables
10. Introduction to Drools Flow for workflow
11. A very brief introduction to Drools Guvnor, Fusion and
Planner
Rule Engine?
3
 Drools is a Rule Engine that uses the rule-
based approach to implement an Expert
System
 A Production Rule is a two-part structure using
First Order Logic for reasoning over
knowledge representation.
 The inference engine matches the rules
against the facts (objects) in memory
when
<conditions>
then
<actions>;
Rule Engine?
4
•The rules are loaded into production memory and are available at all times
•Facts are asserted into the Working Memory where they may then be modified
or retracted.
•The Agenda manages the execution order of the conflicting rules using a
conflict resolution strategy.
•The rules might be in conflict when more than 1 rule matches the same set of
facts in working memory
Backward Vs Forward Chaining
5
 A forward chaining engine looks at the facts
and derives a conclusion
Consider a scenario of medical diagnosis => If
the patient’s symptoms are put as facts into
working memory, then we can diagnose him with
an ailment.
When
nasal congestion
&& fever
&& body ache
Then
Influensa
Working memory
1. body ache
2. Fever
3. Nasal
congestion
INFLUENZA
Backward Vs Forward Chaining
6
 A backward chaining engine has the “goal”
specified and the engine tries to satisfy it.
Consider the same scenario of medical diagnosis =>
if there is an epidemic of a certain disease, this AI
could presume a given individual had the disease
and attempt to determine if its diagnosis is correct
based on available information.
Goal
Influensa
Sub-goal
nasal congestion
fever
body ache
Working memory
1. body ache
2. fever
NO INFLUENZA
Drools Basics
7
 Knowledge Sessions
Stateless
 Doesn’t maintain reference to objects after first call and can be thought of as plain
functions
 Typical use cases include validation, routing etc
Stateful
 Longer lived, maintain reference to objects and allow iterative changes over time
 Typical use cases include diagnostics, monitoring etc
 In contrast to a Stateless Session, the dispose() method must be called afterwards
to ensure there are no memory leaks.
 Facts
Facts are objects that are inserted/modified/retracted from working memory AND is
the data on which the rules act.
"logicalInsert" => Here the fact is logically inserted, this fact is dependant on the truth
of the "when" clause. It means that when the rule becomes false the fact is
automatically retracted.
 A rule while firing can change the state of the working memory thereby causing other
rules to fire.
Sample Drools Rule
8
When part
package com.anil.drools.service
import com.anil.drools.model.Fire;
import com.anil.drools.model.Alarm;
global Logger LOGGER;
rule "Raise the alarm when there is at least 1 Fire"
salience 100
lock-on-active true
when
exists Fire()
then
insert (new Alarm());
LOGGER.debug( "Raised the alarm because at least 1
Fire() object exists in the session" );
end
Rule Name
Attributes
Then part
Package Name
(Must be 1st element if
declared)
Import java types
(referenced by rules)
Global variables
Rule Attributes
9
 Rule attributes provide a declarative way to
influence the behavior of the rule.
no-loop
 When a rule's consequence modifies a fact it may cause the rule
to activate again, causing an infinite loop.
lock-on-active
 This is a stronger version of no-loop, because the change could
now be caused not only by the rule itself but by other rules too.
Salience
 Salience is a form of priority where rules(all of whom match) with
higher salience values are given higher priority when ordered in
the Activation queue.
agenda-group
 Only rules in the agenda group that has acquired the focus are
allowed to fire.
Refer to Drools documentation for additional attributes
Drools Operators
10
 < <= > >=
Person( firstName < $otherFirstName )
 [not] matches (against Java regex)
Cheese( type matches "(Buffalo)?S*Mozarella" )
 [not] contains (check field within array/collection)
CheeseCounter( cheeses contains "stilton" )
 soundslike
// match cheese "fubar" or "foobar"
Cheese( name soundslike 'foobar' )
 str
Message( routingValue str[startsWith] "R1" )
 [not] in
Cheese( type in ( "stilton", "cheddar", $cheese ) )
Drools Conditional Elements
11
 and / or
Cheese( cheeseType : type ) and Person( favouriteCheese ==
cheeseType )
Cheese( cheeseType : type ) or Person( favouriteCheese ==
cheeseType )
 not
not Bus(color == "red")
 exists
exists Bus(color == "red")
 forall
forall( $bus : Bus( type == 'english')
Bus( this == $bus, color = 'red' ) )
 eval
eval( p1.getList().containsKey( p2.getItem() ) )
Drools Conditional Elements
12
 from
$order : Order()
$item : OrderItem( value > 100 ) from $order.items
 collect
$system : System()
$alarms : ArrayList( size >= 3 ) from collect( Alarm( system ==
$system, status == 'pending' ) )
 accumulate
$order : Order()
$total : Number( doubleValue > 100 ) from accumulate( OrderItem(
order == $order, $value : value ), sum( $value ) )
weeklyVariance : Number( ) from accumulate (Number(
valueReturned : doubleValue) from ruleVO.varianceList,
sum(valueReturned))
The Problem!!
13
 Fire Alarm Mgmt System
Everyone is happy if there is no fire
If there is fire in any room, set an alarm
If there is fire in a room, turn ON sprinkler for that
room
Once the fire extinguishes, turn OFF sprinkler for
that room
If there is NO fire and sprinklers are off; tell
everyone to get back to being happy 
Demo
14
 Source code available at
https://github.com/anilallewar/drools-Example
Using Timers
15
 Rules support both interval and cron based
timers modeled on Quartz.
rule "Send SMS every 15 minutes"
timer (cron:* 0/15 * * * ?)
when
$a : Alarm( on == true )
then
channels[ "sms" ].insert( new Sms( $a.mobileNumber, "The alarm is
still on" );
end
More On Deploying
16
 Changesets
Configuration to build the knowledgebase
Use an XML that contains a list of resources and
can contain reference to another changeset
(recursive changesets)<change-set xmlns='http://drools.org/drools-5.0/change-set'
xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
xs:schemaLocation='http://drools.org/drools-5.0/change-set
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-
api/src/main/resources/change-set-1.0.0.xsd' >
<add>
<resource source='http://fqng-app02-dev-jboss:8080/drools-
guvnor/org.drools.guvnor.Guvnor/package/fqAlarmWorkflow/LATEST'
type='PKG' basicAuthentication=‘enabled’ username=‘admin’ password=‘’/>
</add>
</change-set>
Knowledge Agents
17
 The Knowlege Agent provides automatic loading,
caching and re-loading of resources and is configured
from a properties files OR
KnowledgeAgentConfiguration.
 A KnowledgeAgent object will continuously scan all
the added resources, using a default polling interval
of 60 seconds(can be changd) and, when some last
modification date is updated, it will applied the
changes into the cached Knowledge Base using the
new resources.
 For polling to occur, the polling and notifier services
must be started.
ResourceFactory.getResourceChangeNotifierService().start();
ResourceFactory.getResourceChangeScannerService().start();
Decision Tables
18
 Managing rules in a spreadsheet format
 In a decision table each row is a rule, and
each column in that row is either a condition or
action for that rule.
RuleSet com.anil.drools.decisiontable
Import
com.anil.drools.model.decisiontable.Driver,
com.anil.drools.model.decisiontable.Policy
Variables
Notes Decision tables for policy prices
RuleTable policy prices
POLICY NAME CONDITION CONDITION CONDITION CONDITION ACTION ACTION
$driver : Driver $policy : Policy
age >=$1 && age<=$2 locationRiskProfile numberOfPriorClaims policyType $policy.setPolicyBasePrice($param); System.out.println("$param");
Name Driver Age Bracket Location Risk Profile Number of Prior Claims Insurance Policy Type Base $ price Reason
Young Safe driver
18,24 LOW 1 COMPREHENSIVE 490.00 1 prior claims
18,24 MED FIRE_THEFT 56.00 Fire theft medium
18,24 MED COMPREHENSIVE 700.00 Comprehensive medium
18,24 LOW 2 FIRE_THEFT 250.00 2 prior claims
18,24 LOW 0 COMPREHENSIVE 400.00 Safe driver discount
Mature Drivers
25,60 LOW 1 COMPREHENSIVE 420.00 mature - 1 prior claims
25,60 MED FIRE_THEFT 37.00 mature - Fire theft medium
25,60 MED COMPREHENSIVE 645.00 mature - Comprehensive medium
25,60 LOW 2 FIRE_THEFT 234.00 mature - 2 prior claims
25,60 LOW 0 COMPREHENSIVE 356.00 mature - Safe driver discount
Drools Flow
19
 Drools flow is used in conjuction with Drools Expert to
specify the flow of business rules.
 The nodes are specified by the ruleflow-group rule
attribute.
 As of Drools 5, Drools flow is going to be combined with
jBPM and is renamed as jBPM 5.0.
Other Drools Offerings
20
 Guvnor
Guvnor is the Drools business rule management
system that allows people to manage rules in a multi
user environment, it is a single point of truth for your
business rules, allowing change in a controlled
fashion, with user friendly interfaces.
The Guvnor combined with the core drools engine
and other tools forms the business rules manager.
The data can be stored with multiple persistence
schemas (file, database etc) using the JackRabbit
JCR (Java content repository) as the underlying
implementation.
Guvnor offers versioning of rules, authentication and
authorization to limit users to what they can do.
Other Drools Offerings
21
 Planner
Drools Planner optimizes planning problems. It solves use cases,
such as:
 Employee shift rostering: rostering nurses, repairmen, …
 Agenda scheduling: scheduling meetings, appointments, maintenance jobs,
advertisements, …
 Educational timetabling: scheduling lessons, courses, exams, conference
presentations, ...
 Fusion
Drools Fusion supports complex event processing
It deals with the tasks of handling multiple events nearly at real-
time with the goal of identifying the meaningful events within the
event cloud.
Events, from a Drools perspective are just a special type of fact.
In this way, we can say that all events are facts, but not all facts
are events.
Questions?

More Related Content

What's hot

Drools 6 deep dive
Drools 6 deep diveDrools 6 deep dive
Drools 6 deep dive
Mario Fusco
 
DDD 구현기초 (거의 Final 버전)
DDD 구현기초 (거의 Final 버전)DDD 구현기초 (거의 Final 버전)
DDD 구현기초 (거의 Final 버전)
beom kyun choi
 
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015PostgreSQL-Consulting
 
Drools 6.0 (Red Hat Summit)
Drools 6.0 (Red Hat Summit)Drools 6.0 (Red Hat Summit)
Drools 6.0 (Red Hat Summit)
Mark Proctor
 
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
PgDay.Seoul
 
[NDC17] Kubernetes로 개발서버 간단히 찍어내기
[NDC17] Kubernetes로 개발서버 간단히 찍어내기[NDC17] Kubernetes로 개발서버 간단히 찍어내기
[NDC17] Kubernetes로 개발서버 간단히 찍어내기
SeungYong Oh
 
MongoDB presentation
MongoDB presentationMongoDB presentation
MongoDB presentation
Hyphen Call
 
MongoDB Schema Design (Event: An Evening with MongoDB Houston 3/11/15)
MongoDB Schema Design (Event: An Evening with MongoDB Houston 3/11/15)MongoDB Schema Design (Event: An Evening with MongoDB Houston 3/11/15)
MongoDB Schema Design (Event: An Evening with MongoDB Houston 3/11/15)
MongoDB
 
EDB Failover Manager - Features and Demo
EDB Failover Manager - Features and DemoEDB Failover Manager - Features and Demo
EDB Failover Manager - Features and Demo
EDB
 
MySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptxMySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptx
NeoClova
 
LMAX Disruptor - High Performance Inter-Thread Messaging Library
LMAX Disruptor - High Performance Inter-Thread Messaging LibraryLMAX Disruptor - High Performance Inter-Thread Messaging Library
LMAX Disruptor - High Performance Inter-Thread Messaging Library
Sebastian Andrasoni
 
MariaDB MaxScale
MariaDB MaxScaleMariaDB MaxScale
MariaDB MaxScale
MariaDB plc
 
Action Jackson! Effective JSON processing in Spring Boot Applications
Action Jackson! Effective JSON processing in Spring Boot ApplicationsAction Jackson! Effective JSON processing in Spring Boot Applications
Action Jackson! Effective JSON processing in Spring Boot Applications
Joris Kuipers
 
Json in Postgres - the Roadmap
 Json in Postgres - the Roadmap Json in Postgres - the Roadmap
Json in Postgres - the Roadmap
EDB
 
MongoDB WiredTiger Internals: Journey To Transactions
MongoDB WiredTiger Internals: Journey To TransactionsMongoDB WiredTiger Internals: Journey To Transactions
MongoDB WiredTiger Internals: Journey To Transactions
Mydbops
 
[pgday.Seoul 2022] PostgreSQL구조 - 윤성재
[pgday.Seoul 2022] PostgreSQL구조 - 윤성재[pgday.Seoul 2022] PostgreSQL구조 - 윤성재
[pgday.Seoul 2022] PostgreSQL구조 - 윤성재
PgDay.Seoul
 
MySQL/MariaDB Proxy Software Test
MySQL/MariaDB Proxy Software TestMySQL/MariaDB Proxy Software Test
MySQL/MariaDB Proxy Software Test
I Goo Lee
 
Pragmatic functional refactoring with java 8
Pragmatic functional refactoring with java 8Pragmatic functional refactoring with java 8
Pragmatic functional refactoring with java 8
RichardWarburton
 
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개
if kakao
 
Whitebox testing of Spring Boot applications
Whitebox testing of Spring Boot applicationsWhitebox testing of Spring Boot applications
Whitebox testing of Spring Boot applications
Yura Nosenko
 

What's hot (20)

Drools 6 deep dive
Drools 6 deep diveDrools 6 deep dive
Drools 6 deep dive
 
DDD 구현기초 (거의 Final 버전)
DDD 구현기초 (거의 Final 버전)DDD 구현기초 (거의 Final 버전)
DDD 구현기초 (거의 Final 버전)
 
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015
 
Drools 6.0 (Red Hat Summit)
Drools 6.0 (Red Hat Summit)Drools 6.0 (Red Hat Summit)
Drools 6.0 (Red Hat Summit)
 
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
 
[NDC17] Kubernetes로 개발서버 간단히 찍어내기
[NDC17] Kubernetes로 개발서버 간단히 찍어내기[NDC17] Kubernetes로 개발서버 간단히 찍어내기
[NDC17] Kubernetes로 개발서버 간단히 찍어내기
 
MongoDB presentation
MongoDB presentationMongoDB presentation
MongoDB presentation
 
MongoDB Schema Design (Event: An Evening with MongoDB Houston 3/11/15)
MongoDB Schema Design (Event: An Evening with MongoDB Houston 3/11/15)MongoDB Schema Design (Event: An Evening with MongoDB Houston 3/11/15)
MongoDB Schema Design (Event: An Evening with MongoDB Houston 3/11/15)
 
EDB Failover Manager - Features and Demo
EDB Failover Manager - Features and DemoEDB Failover Manager - Features and Demo
EDB Failover Manager - Features and Demo
 
MySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptxMySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptx
 
LMAX Disruptor - High Performance Inter-Thread Messaging Library
LMAX Disruptor - High Performance Inter-Thread Messaging LibraryLMAX Disruptor - High Performance Inter-Thread Messaging Library
LMAX Disruptor - High Performance Inter-Thread Messaging Library
 
MariaDB MaxScale
MariaDB MaxScaleMariaDB MaxScale
MariaDB MaxScale
 
Action Jackson! Effective JSON processing in Spring Boot Applications
Action Jackson! Effective JSON processing in Spring Boot ApplicationsAction Jackson! Effective JSON processing in Spring Boot Applications
Action Jackson! Effective JSON processing in Spring Boot Applications
 
Json in Postgres - the Roadmap
 Json in Postgres - the Roadmap Json in Postgres - the Roadmap
Json in Postgres - the Roadmap
 
MongoDB WiredTiger Internals: Journey To Transactions
MongoDB WiredTiger Internals: Journey To TransactionsMongoDB WiredTiger Internals: Journey To Transactions
MongoDB WiredTiger Internals: Journey To Transactions
 
[pgday.Seoul 2022] PostgreSQL구조 - 윤성재
[pgday.Seoul 2022] PostgreSQL구조 - 윤성재[pgday.Seoul 2022] PostgreSQL구조 - 윤성재
[pgday.Seoul 2022] PostgreSQL구조 - 윤성재
 
MySQL/MariaDB Proxy Software Test
MySQL/MariaDB Proxy Software TestMySQL/MariaDB Proxy Software Test
MySQL/MariaDB Proxy Software Test
 
Pragmatic functional refactoring with java 8
Pragmatic functional refactoring with java 8Pragmatic functional refactoring with java 8
Pragmatic functional refactoring with java 8
 
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개
 
Whitebox testing of Spring Boot applications
Whitebox testing of Spring Boot applicationsWhitebox testing of Spring Boot applications
Whitebox testing of Spring Boot applications
 

Similar to JBoss Drools - Pure Java Rule Engine

Integrating DROOLS With Mule ESB
Integrating DROOLS With Mule ESBIntegrating DROOLS With Mule ESB
Integrating DROOLS With Mule ESB
Jitendra Bafna
 
Droolsand Rule Based Systems 2008 Srping
Droolsand Rule Based Systems 2008 SrpingDroolsand Rule Based Systems 2008 Srping
Droolsand Rule Based Systems 2008 Srping
Srinath Perera
 
Introducing Drools
Introducing DroolsIntroducing Drools
Introducing DroolsMario Fusco
 
Rule Engine & Drools
Rule Engine & DroolsRule Engine & Drools
Rule Engine & Drools
Sandip Jadhav
 
The RuleML Perspective on Reaction Rule Standards
The RuleML Perspective on Reaction Rule StandardsThe RuleML Perspective on Reaction Rule Standards
The RuleML Perspective on Reaction Rule Standards
Adrian Paschke
 
Drools5 Community Training Module#1: Drools5 BLiP Introduction
Drools5 Community Training Module#1: Drools5 BLiP IntroductionDrools5 Community Training Module#1: Drools5 BLiP Introduction
Drools5 Community Training Module#1: Drools5 BLiP IntroductionMauricio (Salaboy) Salatino
 
Adavanced faulthandling
Adavanced faulthandlingAdavanced faulthandling
Adavanced faulthandling
xavier john
 
salesforce triggers interview questions and answers
salesforce triggers interview questions and answerssalesforce triggers interview questions and answers
salesforce triggers interview questions and answers
bhanuadmob
 
Rules Programming tutorial
Rules Programming tutorialRules Programming tutorial
Rules Programming tutorialSrinath Perera
 
Firewall best-practices-firewall-analyzer
Firewall best-practices-firewall-analyzerFirewall best-practices-firewall-analyzer
Firewall best-practices-firewall-analyzer
iDric Soluciones de TI y Seguridad Informática
 
Buenos Aires Drools Expert Presentation
Buenos Aires Drools Expert PresentationBuenos Aires Drools Expert Presentation
Buenos Aires Drools Expert Presentation
Mark Proctor
 
Command reference nos-v3_5
Command reference nos-v3_5Command reference nos-v3_5
Command reference nos-v3_5
Ploynatcha Akkaraputtipat
 
Pl sql office hours data setup and teardown in database testing
Pl sql office hours   data setup and teardown in database testingPl sql office hours   data setup and teardown in database testing
Pl sql office hours data setup and teardown in database testing
DeeptiBandari
 
Drools
DroolsDrools
Drools
TedGao
 
Drools Introduction
Drools IntroductionDrools Introduction
Drools Introduction
JBug Italy
 
Monitor(karthika)
Monitor(karthika)Monitor(karthika)
Monitor(karthika)Nagarajan
 
Database firewall policies copy
Database firewall policies   copyDatabase firewall policies   copy
Database firewall policies copy
Oracle Apps DBA
 
Dev confus.2020 compliance operator
Dev confus.2020 compliance operatorDev confus.2020 compliance operator
Dev confus.2020 compliance operator
jaormx
 
Relational Database Management System-- vivek singh
Relational Database Management System-- vivek singhRelational Database Management System-- vivek singh
Relational Database Management System-- vivek singh
shekhawatvsshp
 

Similar to JBoss Drools - Pure Java Rule Engine (20)

Integrating DROOLS With Mule ESB
Integrating DROOLS With Mule ESBIntegrating DROOLS With Mule ESB
Integrating DROOLS With Mule ESB
 
Droolsand Rule Based Systems 2008 Srping
Droolsand Rule Based Systems 2008 SrpingDroolsand Rule Based Systems 2008 Srping
Droolsand Rule Based Systems 2008 Srping
 
Introducing Drools
Introducing DroolsIntroducing Drools
Introducing Drools
 
Rule Engine & Drools
Rule Engine & DroolsRule Engine & Drools
Rule Engine & Drools
 
The RuleML Perspective on Reaction Rule Standards
The RuleML Perspective on Reaction Rule StandardsThe RuleML Perspective on Reaction Rule Standards
The RuleML Perspective on Reaction Rule Standards
 
Drools5 Community Training Module#1: Drools5 BLiP Introduction
Drools5 Community Training Module#1: Drools5 BLiP IntroductionDrools5 Community Training Module#1: Drools5 BLiP Introduction
Drools5 Community Training Module#1: Drools5 BLiP Introduction
 
Adavanced faulthandling
Adavanced faulthandlingAdavanced faulthandling
Adavanced faulthandling
 
Adavanced faulthandling
Adavanced faulthandlingAdavanced faulthandling
Adavanced faulthandling
 
salesforce triggers interview questions and answers
salesforce triggers interview questions and answerssalesforce triggers interview questions and answers
salesforce triggers interview questions and answers
 
Rules Programming tutorial
Rules Programming tutorialRules Programming tutorial
Rules Programming tutorial
 
Firewall best-practices-firewall-analyzer
Firewall best-practices-firewall-analyzerFirewall best-practices-firewall-analyzer
Firewall best-practices-firewall-analyzer
 
Buenos Aires Drools Expert Presentation
Buenos Aires Drools Expert PresentationBuenos Aires Drools Expert Presentation
Buenos Aires Drools Expert Presentation
 
Command reference nos-v3_5
Command reference nos-v3_5Command reference nos-v3_5
Command reference nos-v3_5
 
Pl sql office hours data setup and teardown in database testing
Pl sql office hours   data setup and teardown in database testingPl sql office hours   data setup and teardown in database testing
Pl sql office hours data setup and teardown in database testing
 
Drools
DroolsDrools
Drools
 
Drools Introduction
Drools IntroductionDrools Introduction
Drools Introduction
 
Monitor(karthika)
Monitor(karthika)Monitor(karthika)
Monitor(karthika)
 
Database firewall policies copy
Database firewall policies   copyDatabase firewall policies   copy
Database firewall policies copy
 
Dev confus.2020 compliance operator
Dev confus.2020 compliance operatorDev confus.2020 compliance operator
Dev confus.2020 compliance operator
 
Relational Database Management System-- vivek singh
Relational Database Management System-- vivek singhRelational Database Management System-- vivek singh
Relational Database Management System-- vivek singh
 

Recently uploaded

Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
Srikant77
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Anthony Dahanne
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
kalichargn70th171
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 

Recently uploaded (20)

Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 

JBoss Drools - Pure Java Rule Engine

  • 2. Agenda 2 1. Introduction to Knowledge based Rule Engine 2. Basics of Drools rules 3. Drools Operators 4. Drools Conditional Elements 5. The problem - Fire Alarm Management System 6. Drools Demo 7. How to control execution of rules - timers 8. Drools integration into Java - using knowledge agent, changeset 9. Introduction to decision tables 10. Introduction to Drools Flow for workflow 11. A very brief introduction to Drools Guvnor, Fusion and Planner
  • 3. Rule Engine? 3  Drools is a Rule Engine that uses the rule- based approach to implement an Expert System  A Production Rule is a two-part structure using First Order Logic for reasoning over knowledge representation.  The inference engine matches the rules against the facts (objects) in memory when <conditions> then <actions>;
  • 4. Rule Engine? 4 •The rules are loaded into production memory and are available at all times •Facts are asserted into the Working Memory where they may then be modified or retracted. •The Agenda manages the execution order of the conflicting rules using a conflict resolution strategy. •The rules might be in conflict when more than 1 rule matches the same set of facts in working memory
  • 5. Backward Vs Forward Chaining 5  A forward chaining engine looks at the facts and derives a conclusion Consider a scenario of medical diagnosis => If the patient’s symptoms are put as facts into working memory, then we can diagnose him with an ailment. When nasal congestion && fever && body ache Then Influensa Working memory 1. body ache 2. Fever 3. Nasal congestion INFLUENZA
  • 6. Backward Vs Forward Chaining 6  A backward chaining engine has the “goal” specified and the engine tries to satisfy it. Consider the same scenario of medical diagnosis => if there is an epidemic of a certain disease, this AI could presume a given individual had the disease and attempt to determine if its diagnosis is correct based on available information. Goal Influensa Sub-goal nasal congestion fever body ache Working memory 1. body ache 2. fever NO INFLUENZA
  • 7. Drools Basics 7  Knowledge Sessions Stateless  Doesn’t maintain reference to objects after first call and can be thought of as plain functions  Typical use cases include validation, routing etc Stateful  Longer lived, maintain reference to objects and allow iterative changes over time  Typical use cases include diagnostics, monitoring etc  In contrast to a Stateless Session, the dispose() method must be called afterwards to ensure there are no memory leaks.  Facts Facts are objects that are inserted/modified/retracted from working memory AND is the data on which the rules act. "logicalInsert" => Here the fact is logically inserted, this fact is dependant on the truth of the "when" clause. It means that when the rule becomes false the fact is automatically retracted.  A rule while firing can change the state of the working memory thereby causing other rules to fire.
  • 8. Sample Drools Rule 8 When part package com.anil.drools.service import com.anil.drools.model.Fire; import com.anil.drools.model.Alarm; global Logger LOGGER; rule "Raise the alarm when there is at least 1 Fire" salience 100 lock-on-active true when exists Fire() then insert (new Alarm()); LOGGER.debug( "Raised the alarm because at least 1 Fire() object exists in the session" ); end Rule Name Attributes Then part Package Name (Must be 1st element if declared) Import java types (referenced by rules) Global variables
  • 9. Rule Attributes 9  Rule attributes provide a declarative way to influence the behavior of the rule. no-loop  When a rule's consequence modifies a fact it may cause the rule to activate again, causing an infinite loop. lock-on-active  This is a stronger version of no-loop, because the change could now be caused not only by the rule itself but by other rules too. Salience  Salience is a form of priority where rules(all of whom match) with higher salience values are given higher priority when ordered in the Activation queue. agenda-group  Only rules in the agenda group that has acquired the focus are allowed to fire. Refer to Drools documentation for additional attributes
  • 10. Drools Operators 10  < <= > >= Person( firstName < $otherFirstName )  [not] matches (against Java regex) Cheese( type matches "(Buffalo)?S*Mozarella" )  [not] contains (check field within array/collection) CheeseCounter( cheeses contains "stilton" )  soundslike // match cheese "fubar" or "foobar" Cheese( name soundslike 'foobar' )  str Message( routingValue str[startsWith] "R1" )  [not] in Cheese( type in ( "stilton", "cheddar", $cheese ) )
  • 11. Drools Conditional Elements 11  and / or Cheese( cheeseType : type ) and Person( favouriteCheese == cheeseType ) Cheese( cheeseType : type ) or Person( favouriteCheese == cheeseType )  not not Bus(color == "red")  exists exists Bus(color == "red")  forall forall( $bus : Bus( type == 'english') Bus( this == $bus, color = 'red' ) )  eval eval( p1.getList().containsKey( p2.getItem() ) )
  • 12. Drools Conditional Elements 12  from $order : Order() $item : OrderItem( value > 100 ) from $order.items  collect $system : System() $alarms : ArrayList( size >= 3 ) from collect( Alarm( system == $system, status == 'pending' ) )  accumulate $order : Order() $total : Number( doubleValue > 100 ) from accumulate( OrderItem( order == $order, $value : value ), sum( $value ) ) weeklyVariance : Number( ) from accumulate (Number( valueReturned : doubleValue) from ruleVO.varianceList, sum(valueReturned))
  • 13. The Problem!! 13  Fire Alarm Mgmt System Everyone is happy if there is no fire If there is fire in any room, set an alarm If there is fire in a room, turn ON sprinkler for that room Once the fire extinguishes, turn OFF sprinkler for that room If there is NO fire and sprinklers are off; tell everyone to get back to being happy 
  • 14. Demo 14  Source code available at https://github.com/anilallewar/drools-Example
  • 15. Using Timers 15  Rules support both interval and cron based timers modeled on Quartz. rule "Send SMS every 15 minutes" timer (cron:* 0/15 * * * ?) when $a : Alarm( on == true ) then channels[ "sms" ].insert( new Sms( $a.mobileNumber, "The alarm is still on" ); end
  • 16. More On Deploying 16  Changesets Configuration to build the knowledgebase Use an XML that contains a list of resources and can contain reference to another changeset (recursive changesets)<change-set xmlns='http://drools.org/drools-5.0/change-set' xmlns:xs='http://www.w3.org/2001/XMLSchema-instance' xs:schemaLocation='http://drools.org/drools-5.0/change-set http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools- api/src/main/resources/change-set-1.0.0.xsd' > <add> <resource source='http://fqng-app02-dev-jboss:8080/drools- guvnor/org.drools.guvnor.Guvnor/package/fqAlarmWorkflow/LATEST' type='PKG' basicAuthentication=‘enabled’ username=‘admin’ password=‘’/> </add> </change-set>
  • 17. Knowledge Agents 17  The Knowlege Agent provides automatic loading, caching and re-loading of resources and is configured from a properties files OR KnowledgeAgentConfiguration.  A KnowledgeAgent object will continuously scan all the added resources, using a default polling interval of 60 seconds(can be changd) and, when some last modification date is updated, it will applied the changes into the cached Knowledge Base using the new resources.  For polling to occur, the polling and notifier services must be started. ResourceFactory.getResourceChangeNotifierService().start(); ResourceFactory.getResourceChangeScannerService().start();
  • 18. Decision Tables 18  Managing rules in a spreadsheet format  In a decision table each row is a rule, and each column in that row is either a condition or action for that rule. RuleSet com.anil.drools.decisiontable Import com.anil.drools.model.decisiontable.Driver, com.anil.drools.model.decisiontable.Policy Variables Notes Decision tables for policy prices RuleTable policy prices POLICY NAME CONDITION CONDITION CONDITION CONDITION ACTION ACTION $driver : Driver $policy : Policy age >=$1 && age<=$2 locationRiskProfile numberOfPriorClaims policyType $policy.setPolicyBasePrice($param); System.out.println("$param"); Name Driver Age Bracket Location Risk Profile Number of Prior Claims Insurance Policy Type Base $ price Reason Young Safe driver 18,24 LOW 1 COMPREHENSIVE 490.00 1 prior claims 18,24 MED FIRE_THEFT 56.00 Fire theft medium 18,24 MED COMPREHENSIVE 700.00 Comprehensive medium 18,24 LOW 2 FIRE_THEFT 250.00 2 prior claims 18,24 LOW 0 COMPREHENSIVE 400.00 Safe driver discount Mature Drivers 25,60 LOW 1 COMPREHENSIVE 420.00 mature - 1 prior claims 25,60 MED FIRE_THEFT 37.00 mature - Fire theft medium 25,60 MED COMPREHENSIVE 645.00 mature - Comprehensive medium 25,60 LOW 2 FIRE_THEFT 234.00 mature - 2 prior claims 25,60 LOW 0 COMPREHENSIVE 356.00 mature - Safe driver discount
  • 19. Drools Flow 19  Drools flow is used in conjuction with Drools Expert to specify the flow of business rules.  The nodes are specified by the ruleflow-group rule attribute.  As of Drools 5, Drools flow is going to be combined with jBPM and is renamed as jBPM 5.0.
  • 20. Other Drools Offerings 20  Guvnor Guvnor is the Drools business rule management system that allows people to manage rules in a multi user environment, it is a single point of truth for your business rules, allowing change in a controlled fashion, with user friendly interfaces. The Guvnor combined with the core drools engine and other tools forms the business rules manager. The data can be stored with multiple persistence schemas (file, database etc) using the JackRabbit JCR (Java content repository) as the underlying implementation. Guvnor offers versioning of rules, authentication and authorization to limit users to what they can do.
  • 21. Other Drools Offerings 21  Planner Drools Planner optimizes planning problems. It solves use cases, such as:  Employee shift rostering: rostering nurses, repairmen, …  Agenda scheduling: scheduling meetings, appointments, maintenance jobs, advertisements, …  Educational timetabling: scheduling lessons, courses, exams, conference presentations, ...  Fusion Drools Fusion supports complex event processing It deals with the tasks of handling multiple events nearly at real- time with the goal of identifying the meaningful events within the event cloud. Events, from a Drools perspective are just a special type of fact. In this way, we can say that all events are facts, but not all facts are events.

Editor's Notes

  1. Stateless Knowledge Session examples 1. Validation - Is this person eligible for a mortgage? 2. Calculation - Compute a mortgage premium. 3. Routing and Filtering - Filter incoming messages, such as emails, into folders. Send incoming messages to a destination. Stateful Knowledge Session examples 1. Monitoring - Stock market monitoring and analysis for semi-automatic buying. 2. Diagnostics - Fault finding, medical diagnostics 3. Logistics - Parcel tracking and delivery provisioning 4. Compliance - Validation of legality for market trades.
  2. Globals are not inserted into the Working Memory, and therefore a global should never be used to establish conditions in rules except when it has a constant immutable value. If multiple packages declare globals with the same identifier they must be of the same type and all of them will reference the same global value. All operators have normal Java semantics except for == and !=. The == operator has null-safe equals() semantics i.e. it is equivalent to equals() method.
  3. Soundslike - checks whether a word has almost the same sound (using English pronunciation) as the given value. str - This operator str is used to check whether a field that is a String starts with or ends with a certain value. It can also be used to check the length of the String.
  4. forall - forall evaluates to true when all facts that match the first pattern match all the remaining patterns. In the above rule, we "select" all Bus objects whose type is "english". Then, for each fact that matches this pattern we evaluate the following patterns and if they match, the forall CE will evaluate to true. eval - The conditional element eval is essentially a catch-all which allows any semantic code (that returns a primitive boolean) to be executed.
  5. from - from will iterate over all objects in the collection and try to match each of them individually. The rule gets fired for each item that is matched. collect - Allows us to reason over a collection of objects. In the above example, the rule will look for all pending alarms in the working memory for each given system and group them in ArrayLists. If 3 or more alarms are found for a given system, the rule will fire. The result pattern of collect can be any concrete class that implements the java.util.Collection interface and provides a default no-arg public constructor. accumulate - Allows a rule to iterate over a collection of objects, executing custom actions for each of the elements, and at the end it returns a result object. Drools ships with the following built-in accumulate functions: average min max count sum collectList collectSet You can build your own accumulate functions by implementing org.drools.runtime.rule.AccumulateFunction interface and add a line to the configuration file or set a system property to let the engine know about the new function.
  6. Please refer to the “drools-Example” project for the demo.