Master Drools

How to use Drools Rule Engine to decouple complex business decision trees into individual simple to read rules

Last updated 2022-01-10 | 4.3

- program rules in Drools domain specific language
- detect problems and patterns in software development that are good to be solved with a rule engine like Drools
- decouple complex decision trees into individual simple to understand rules

What you'll learn

program rules in Drools domain specific language
detect problems and patterns in software development that are good to be solved with a rule engine like Drools
decouple complex decision trees into individual simple to understand rules

* Requirements

* You should have basic understanding of Java programming

Description

We learn Drools DSL (Drools programming language) and see what kind of problems Drools works best with.

This course comes with a Java project that has all the code we look throughout this course. You are encouraged to run the code yourself to get better understanding.

We also cover some of the best practises when building rule engine like Drools.

After completing this course you are confident when to youse Drools in a project and how to write business rules in Drools DSL.

Who this course is for:

  • Developers and system architects who need to understand what a rule engine is and which type of problems can be solved with it
  • Anyone who needs to write rules in Drools DSL programming language
  • Developers and system architects needing more info about adding Drools rule engine to their project

Course content

8 sections • 48 lectures

Introduction to course Preview 01:02

What is a Rule Engine? Preview 11:10

How to Design Rules and When (not) to Use Drools. Preview 03:39

Introduction to Drools Language Syntax Preview 07:04

Structure of Example Code Preview 05:18

We look at the example code I have created in Github: https://github.com/aasaru/drools-training

Get example code running with IntelliJ IDEA Community Edition Preview 04:46

Get example code running with Eclipse Preview 05:23

NB! After filming this part newer Drools version has been released and I have updated the source code. Please open pom.xml and find out the correct version.

Introduction to Stateless Sessions Preview 03:20

Step1: First two rules to validate passports Preview 07:02

Step2: Split a rule Preview 02:30

Step3: Bind a variable Preview 04:44

Step4: Using the bound variable Preview 02:32

Steps 5 and 6: Avoid repetitions Preview 06:04

Stateless Sessions Summary Preview 00:53

Introduction to Stateful Sessions Preview 01:48

Step1: Modify Object in the Middle of Session Preview 05:35

Step2: Inference Preview 04:27

Stateful Sessions Summary Preview 00:44

Introduction to Cross Products Preview 04:18

Step1: Join Visa Application to a Passport Preview 07:04

Fixed a bug in upcoming lecture Preview 00:18

Step2: Is Passport Valid 6 Months After Trip? Preview 06:57

Step3: When setting a value check that property is not already with this value Preview 03:24

Pattern Matching and Cross Products Summary Preview 03:12

Intro to Adding New Facts & Setting Execution Order Preview 01:07

Rule Dialect Change Preview 00:37

You can write Drools rules in either "java" or in "mvel" dialect.

Here I explain the difference of them and why I changed section06 code to use "java" dialect.

Note about upcoming Step Preview 00:20

Step1: Create a New Fact and Insert it into the Session Preview 05:35

Step2: Control Execution Order with Salience Preview 04:50

Step3: Control Execution Order with Agenda-Groups Preview 13:48

Step4: Use Agenda Groups with Salience Preview 04:47

Step5: Run a Singe Rule from a Activation Group Preview 08:06

Bonus Step! Step 6. Set Focus to Agenda Group In Drools Rule. Preview 00:44

In this self-assignment you learn how to set focus to agenda group in the rules.


I have added this assignment after publishing the course. You may need to run "git pull" to get the latest code. It comes without a video and you must examine the rules and Java code yourself.

Summary of Adding Facts and Setting Execution Order Preview 01:30

Introduction to Logical Insertion of Facts and Checking the Fact Does Not Exist Preview 01:35

Step1: Add Fact Using insertLogical() Preview 06:31

Using optional "this" keyword in left-hand-side of MVEL rules Preview 00:18

Step2: Create Fact Objects and Check that Fact Does Not Exist Using not() Preview 07:25

Step3: Replace Changing of the Objects with Fact Objects Preview 06:24

Step4: Reduce the Number of Rules Needed by Eliminating Positive Cases Preview 03:40

Section Summary Preview 01:23

Intro to working with groups of objects Preview 01:41

Step1: Rewrite visa application logic to support FamilyVisaApplications Preview 06:45

Step2: Exists keyword introduced Preview 02:50

Step3: Use forall to match group of objects Preview 04:52

Step4: Use forall to extract object from group based on min/max value Preview 03:23

Step5: Forall with only one expression Preview 02:39

Summary of Working with Groups of Facts Preview 00:27