Master Drools Programming - Learn How to Write Drools Rules
What you'll learn
- Program rules in Drools 7 domain specific language
- Learn Drools language constructs like insert, modify, exists, forall, insertLogical, salience, agenda-group etc
- Create spreadsheet decision tables and spreadsheet templates
- What is Complex Event Processing and how Drools handles it
- How to use rule templates (DRT or Freemarker) and run dynamically defined DRL
- Understand different Drools running modes (active/passive, cloud/stream, sequential)
- How Drools works internally and what to keep in mind for writing faster performing rules
Requirements
- You should have basic understanding of Java programming
Description
We learn Drools DSL (Drools programming language) and go over the most common DSL constructs. We move in small steps and gradually introduce new concepts so it is easier to follow even for a beginner.
This way we cover the most common Drools topics like:
what is a rule engine
what is the difference between a method and a rule
why one would use a rule engine instead of writing regular Java code
understanding of the when/then clauses
understanding in which order the rules fire and when the order is not known
how to control the execution using activation groups, agenda groups and salience
declaring variables in DRL
difference between stateless and stateful sessions
inserting facts and modifying existing objects in the session
cross products (similar to SQL join)
exists, forall and collect
using spreadsheet decision tables to create Drools rules
using templates for creating rules and feeding data into them from spreadsheets and other tabular data sources
complex event processing (CEP) in Drools
difference between fact and event
declaring facts and events in Java and inside DRL code
different rule execution modes (active/passive, cloud/stream, sequential)
time and length-based sliding windows
entry-points
global variables
timers
how Drools internal algorithm Phreak works
This course comes with two Java projects containing all the code we worked with during the course. The first project includes all the code examples in traditional Drools syntax and a second copy of all the rules in the new Drools OOPath syntax (introduced by Drools 8). The first project has been upgraded to run using Drools 10 (which was released in December 2024!).
You are encouraged to check out and run the code yourself to better understand and experiment with making changes to it. There are instructions on running the code in IntelliJ, Eclipse, and VS Code.
After completing this course, you better understand which kinds of problems could be solved with Drools and how to write the most common 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
- Anyone who is considering using Drools for writing rules or processing stream of events
Instructor
Since 2005 I have been working as a Java Developer / Solution Architect / CTO. I have created several in-class courses and two courses on Udemy. I'm passionate about learning new technologies and explaining them in a clear and understandable way. I'm a fan of domain-specific languages - small programming languages that are designed for a specific task. For the past years, I have been involved with a project that heavily relies on utilizing Drools Rule Engine.