---
description: This drools tutorial covers all basic to advanced concepts like definition, components, architecture, features, programs, adding plugins in eclipse, etc.
title: "Drools Tutorial: Rule Engine Architecture &#038; Diagram"
image: https://www.guru99.com/images/drools-tutorial-1.png
---

[Skip to content](#main)

**⚡ Smart Summary**

Drools is an open-source Business Rules Management System written in Java that separates business logic from application code. This resource explains rules, the Rete algorithm, Drools architecture and components, Eclipse plugin setup, and a Hello World rule example.

- ⚙️ **Core Definition:** Drools is a Java-based BRMS that runs business rules using the Rete pattern-matching algorithm.
- 📜 **Rules Structure:** A rule follows a when-then format, firing actions only when its conditions match facts in working memory.
- 🏗️ **Architecture:** Rules load into a rule base, facts enter working memory, and the engine matches and fires them through an agenda.
- 🔌 **Eclipse Setup:** The Drools plugin installs in Eclipse through the jBPM distribution ZIP and the Install New Software dialog.
- 🔄 **Chaining Modes:** Drools supports forward chaining from facts to conclusions and backward chaining from a goal back to facts.

Read More

![Drools Tutorial](https://www.guru99.com/images/drools-tutorial-1.png)

## What is Drools?

**Drools** is an open-source Business Rules Management Software (BRMS) written in Java that provides users with a variety of features like Business Rule Engine, Web authoring, Rules Management Application, and runtime support for Decision Model and Notation models. It uses advanced implementation system of rete pattern matching algorithm.

Drools was released under Apache License 2.0 and it is compatible with any JVM and available in Maven Central Repository also.

The Drools tool helps you to separate and reason over logic and data found in business processes. It supports forward and backward chaining inference-based drools rules engine.

**Drools are split into two parts:**

- **Authoring** – It involves the development of rules files.
- **Runtime** – It involves the creation of working memory and handling the activation.

## What is Rule?

Rules are parts of knowledge often expressed as, “When specific conditions occur, then do some tasks.”

The most crucial part of a rule is it’s **when** part. Once **when** part is satisfied, **then** the part is triggered.

**Syntax:**

```
When
<Condition is true>
Then
<Take desired Action>

```

### Pattern Matching Method

Pattern matching method helps you to compare new or old facts with the production rules. It is completed by the Inference Engine.

**Algorithms used for Pattern Matching are:**

- Rete Algorithm
- Leaps Algorithm
- Linear Algorithm
- Treat Algorithm

However, the algorithm mostly used by Drools is the Rete Algorithm.

### Rete Algorithm

The Rete algorithm is a useful pattern matching algorithm which allows you to implement production rule systems. It helps you to sacrifice memory for increased speed. It also reduces or eliminates specific types of redundancy with the help of node sharing. It stores partial matches while performing joins between different fact types.

|  | #1 BEST OVERALL [![Zoho Projects]()](https://guru99.live/d88u2f) 9.8/10 ★★★★★ [Start Free Trial](https://guru99.live/d88u2f) | [![Zoho Analytics]()](https://guru99.live/caed0l) 9.5/10 ★★★★★ [Visit Zoho Analytics](https://guru99.live/caed0l) | [![Zoho WorkDrive]()](https://guru99.live/8h8gvo) 9.3/10 ★★★★★ [Visit Zoho WorkDrive](https://guru99.live/8h8gvo) |
| --- | --- | --- | --- |
| Best For | Project Management | BI & Reporting | File Sharing & Collaboration |
| Key Feature | *✓*Automate daily & weekly recurring tasks | *✓*AI-powered reports & insights | *✓*Admin control over shared files |
| Also Includes | *✓*Classic, list & Kanban views | *✓*Blend data from multiple sources | *✓*Real-time file collaboration |
| Free Trial | 15-Day Free Trial | 15-Day Free Trial | 15-Day Free Trial |
|  | [Start Free Trial](https://guru99.live/d88u2f) | [Visit Zoho Analytics](https://guru99.live/caed0l) | [Visit Zoho WorkDrive](https://guru99.live/8h8gvo) |

#1 BEST OVERALL

1 [![Zoho Projects]()](https://guru99.live/d88u2f)

9.8/10

★★★★★

Best For

Project Management

Key Feature

*✓*Automate daily & weekly recurring tasks

Also Includes

*✓*Classic, list & Kanban views

Free Trial

15-Day Free Trial

[Start Free Trial](https://guru99.live/d88u2f)

2 [![Zoho Analytics]()](https://guru99.live/caed0l)

9.5/10

★★★★★

Best For

BI & Reporting

Key Feature

*✓*AI-powered reports & insights

Also Includes

*✓*Blend data from multiple sources

Free Trial

15-Day Free Trial

[Visit Zoho Analytics](https://guru99.live/caed0l)

3 [![Zoho WorkDrive]()](https://guru99.live/8h8gvo)

9.3/10

★★★★★

Best For

File Sharing & Collaboration

Key Feature

*✓*Admin control over shared files

Also Includes

*✓*Real-time file collaboration

Free Trial

15-Day Free Trial

[Visit Zoho WorkDrive](https://guru99.live/8h8gvo)

## Drools Rule Engine

**Drools Rule Engine** is a rule-based approach to implement an Expert system in the Drools software. The Rule engine provides Expert systems which are knowledge-based systems that help you to make decisions like what to do and how to do it. It gathers knowledge into a knowledge base that can be used for reasoning.

**Don't Miss:**

- [BRS Vs. SRS: Key Difference Between Them](https://www.guru99.com/brs-vs-srs-the-myth-busted.html)
- [How to Organize Requirements as a Business Analyst](https://www.guru99.com/present-requirements-business-analyst.html)
- [11 BEST Decision Making Tools and Techniques (2026)](https://www.guru99.com/decision-making-tools.html)
- [9 Best Free Gantt Chart Software Tools (2026)](https://www.guru99.com/free-online-gantt-chart-software.html)

## Drools Tools Suite

Now in this Drools Rule Engine tutorial, we will learn about Drools Tool Suite. Here are five types of tools which come as a part of the Drools suite:

- **Drools Guvnor**: It is a centralized repository for Drools KnowledgeBase.
- **Drools Flow**: It offers workflow and business processes.
- **Drools Fusion**: Tool used for complex event processing
- **Drools Expert or Rules Engine**: A useful tool for performing reasoning.
- **Drools Planner:** To offers automated planning, which includes NP-hard planning problems.

## Important components in Drools

Now in this Drools tutorial, let’s learn about important components of Drools.

Here are essential terms used in Drools:

- **Facts** – Fact represent the data which serves as input for rules
- **Working Memory** – Storage with Facts, where they are used for pattern matching. It can be modified, insert, and remove.
- **Knowledge Session** – This component holds all the resources required for firing rule. Here, all facts are inserted into the single session, and then matching rules are fired.
- **Knowledge Base** – It represents the knowledge in the Drools ecosystem. It stores the formation of the resources where rules are found.
- **Module** – This is a module which stores multiple Knowledge Bases which can hold different sessions

## Architecture of Drools

[![Drools Rule Engine Architecture]()](https://www.guru99.com/images/1/072419_0612_DroolsTutor1.jpg)

*Drools Rule Engine Architecture*

Here is the working system of Drools architecture:

**Step 1)** The rules are loaded into Rule Base, which are available all the times.

**Step 2)** Facts are asserted into the Working Memory where they may then be modified or retracted.

**Step 3)** The process of matching the new or existing facts against production rules is called pattern matching, which is performed by the Rule engine.

**Step 4)** The agenda allows you to manage the execution order of the conflicting rules with the help of a conflict resolution strategy.

## Features of Drool

Here are important features of Drool:

- Helps you to separate application from dynamic logic
- Declarative Programming
- Centralization of Knowledge
- Speed and Scalability
- Separate logic from application
- Understandable rules

## How to add Drools plugins in Eclipse

Now in this Drools tutorial, let’s learn how to add Drools plugin in Eclipse.

**Step 1)** Click on “Distribution ZIP” for jBPM Integration  
 Go to https://www.drools.org/download/download.html and click “Distribution ZIP” for jBPM Integration. Once downloaded, extract it to your hard drive.

[![Add Drools Plugins in Eclipse]()](https://www.guru99.com/images/1/072419_0612_DroolsTutor2.png)

**Step 2)** Install New Software  
 In [Eclipse](https://www.guru99.com/install-eclipse-java.html), select Install New Software.

[![Add Drools Plugins in Eclipse]()](https://www.guru99.com/images/1/072419_0612_DroolsTutor3.png)

**Step 3)** Click on Add button  
 Click on Add button for adding a software.

[![Add Drools Plugins in Eclipse]()](https://www.guru99.com/images/1/072419_0612_DroolsTutor4.png)

**Step 4)** Browse Folder  
 In the next screen, Click on Local and Select folder “org.drools.updatesite/” then Click Ok.

[![Add Drools Plugins in Eclipse]()](https://www.guru99.com/images/1/072419_0612_DroolsTutor5.png)

**Step 5)** Click on the Next button  
 On the install remediation page, click on the Next button.

[![Add Drools Plugins in Eclipse]()](https://www.guru99.com/images/1/072419_0612_DroolsTutor6.png)

**Step 6)** Accept the license agreement  
 Accept the license agreement and click next.

[![Add Drools Plugins in Eclipse]()](https://www.guru99.com/images/1/072419_0612_DroolsTutor7.png)

**Step 7)** Reboot Eclipse  
 The software will download, and you will be asked to reboot eclipse.

**Step 8)** Installation process complete  
 In Windows > Preferences menu, you will see the Drools option indicating it’s installed.

[![Add Drools Plugins in Eclipse]()](https://www.guru99.com/images/1/072419_0612_DroolsTutor8.png)

## Drools Program Hello World Example

Below is a Drools example for Hello World program:

```
package com.sample
import com.sample.DroolsTest.Message;
rule "Hello World"
 when
	m : Message( status ** Message.Hello, myMessage : message )
  then
System.out.println( myMessage );
m.setMessage( "Goodbye cruel world" );
m.setStatus( Message.GOODBYE );
update( m );
end
 rule "GoodBye"

when
	Message( status ** Message.GOODBYE, myMessage : message )
then
System.out.println( myMessage );
end

```

### What is Backward vs. Forward Chaining?

A forward-chaining engine checks the facts and derives a specific conclusion.

Let’s consider a scenario of the medical diagnosis system. If the patient’s symptoms are put as facts into working memory, then it is easy to diagnose him with an ailment.

[![Backward vs. Forward Chaining]()](https://www.guru99.com/images/1/072419_0612_DroolsTutor9.png)

Forward-chaining engine

A backward chaining engine has the set goal, and the engine tries to satisfy it.

Consider the same scenario of medical diagnosis. Assume that 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.

[![Backward vs. Forward Chaining]()](https://www.guru99.com/images/1/072419_0612_DroolsTutor10.png)

Backward-chaining engine

## Why use Drools Rule Engine?

Here, are prime reasons for using Drools rules engine:

- Rules are easy to understand for developers and [business analysts](https://www.guru99.com/introduction-business-analysis.html).
- Rules are easily maintainable.
- Rule Engine uses a Rete algorithm which states that the performance of the engine never depends on the number of rules.
- Rules can be modified and deployed without bringing down the application.
- Externalizes the business logic from the comparatively static codebase.
- Rules are developed in less complicated formats so the business analyst can easily read and verify a group of rules.
- Rules allow you to create a warehouse of knowledge which is executable in form.
- Tools like Eclipse help you to manage rules, get an instant response, authentication, and content support.

## Disadvantages of Rules Engine

Here, are drawbacks/ cons of using rules engine:

- Lots of learning effort requires by developers to know this method of programming
- Rule engine is not a secure method to troubleshoot issues.
- Needs to understand the working of rule engine to consume more memory
- There are a wide set of rules for a complex branching.

Rules may change over time and will become effective with code changes

## FAQs

💲 Is Drools free and open source?

Yes. Drools is released under the Apache License 2.0 and is completely free and open source. It runs on any JVM and is available through the Maven Central Repository for easy project integration.

📝 What language are Drools rules written in?

Drools rules are written in DRL (Drools Rule Language), a declarative syntax based on the when-then structure. Rules can also be authored using decision tables, DMN models, or domain-specific languages for business users.

⚖️ How does a rule engine differ from a traditional if-else approach?

A rule engine externalizes logic into maintainable rules that change without redeploying the application. Hard-coded if-else logic is scattered through the codebase, harder to update, and does not scale well as the number of conditions grows.

🤖 How does Drools relate to AI and expert systems?

Drools implements expert systems, a classic branch of AI, by encoding human knowledge as rules. The engine reasons over facts to reach conclusions, supporting forward and backward chaining similar to symbolic AI decision systems.

✨ Can AI help generate or optimize Drools rules?

Yes. AI assistants can draft DRL rules from plain-language requirements, detect conflicting or redundant rules, and suggest optimizations. Teams still validate the generated rules to ensure correct business logic and reliable execution.

#### Summarize this post with:

ChatGPTPerplexityGrokGoogle AI

**Stay Updated on AI** **Get Weekly AI Skills, Trends, Actionable Advice.**

##### Sign up for the newsletter

Subscribe for Free

You have successfully subscribed.  
Please check your inbox.

![AI-Newsletter]() Chosen by over **350,000+** professionals

[Scroll to top](#wrapper)

×

Search for:

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://www.guru99.com/#organization","name":"Guru99","sameAs":["https://www.facebook.com/Guru99Official","https://twitter.com/guru99com"],"logo":{"@type":"ImageObject","@id":"https://www.guru99.com/#logo","url":"https://www.guru99.com/images/guru99-logo-v1-150x59.png","contentUrl":"https://www.guru99.com/images/guru99-logo-v1-150x59.png","caption":"Guru99","inLanguage":"en-US"}},{"@type":"WebSite","@id":"https://www.guru99.com/#website","url":"https://www.guru99.com","name":"Guru99","publisher":{"@id":"https://www.guru99.com/#organization"},"inLanguage":"en-US"},{"@type":"ImageObject","@id":"https://www.guru99.com/images/drools-tutorial-1.png","url":"https://www.guru99.com/images/drools-tutorial-1.png","width":"700","height":"250","caption":"Drools Tutorial","inLanguage":"en-US"},{"@type":"BreadcrumbList","@id":"https://www.guru99.com/drools-tutorial.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":"1","item":{"@id":"https://www.guru99.com","name":"Home"}},{"@type":"ListItem","position":"2","item":{"@id":"https://www.guru99.com/business-analyst","name":"Business Analyst"}},{"@type":"ListItem","position":"3","item":{"@id":"https://www.guru99.com/drools-tutorial.html","name":"Drools Tutorial: Rule Engine Architecture &#038; Diagram"}}]},{"@type":"WebPage","@id":"https://www.guru99.com/drools-tutorial.html#webpage","url":"https://www.guru99.com/drools-tutorial.html","name":"Drools Tutorial: Rule Engine Architecture &#038; Diagram","dateModified":"2026-10-10T18:18:25+05:30","isPartOf":{"@id":"https://www.guru99.com/#website"},"primaryImageOfPage":{"@id":"https://www.guru99.com/images/drools-tutorial-1.png"},"inLanguage":"en-US","breadcrumb":{"@id":"https://www.guru99.com/drools-tutorial.html#breadcrumb"}},{"@type":"Person","@id":"https://www.guru99.com/author/editorial","name":"Editorial Team","url":"https://www.guru99.com/author/editorial","image":{"@type":"ImageObject","@id":"https://www.guru99.com/images/favicon-new-logo.png","url":"https://www.guru99.com/images/favicon-new-logo.png","caption":"Editorial Team","inLanguage":"en-US"},"sameAs":["https://www.guru99.com/editorial-team"],"worksFor":{"@id":"https://www.guru99.com/#organization"}},{"articleSection":"Business Analyst","headline":"Drools Tutorial: Rule Engine Architecture &#038; Diagram","description":"This drools tutorial covers all basic to advanced concepts like definition, components, architecture, features, programs, adding plugins in eclipse, etc.","keywords":"business-analyst","speakable":{"@type":"SpeakableSpecification","cssSelector":[".entry-title",".summary"]},"@type":"Article","author":{"@id":"https://www.guru99.com/author/editorial","name":"Editorial Team"},"dateModified":"2026-10-10T18:18:25+05:30","image":{"@id":"https://www.guru99.com/images/drools-tutorial-1.png"},"copyrightYear":"2026","name":"Drools Tutorial: Rule Engine Architecture &#038; Diagram","subjectOf":[{"@type":"HowTo","name":"How to add Drools plugins in Eclipse","description":"Let's take a look at an example of how to add drools plugins in eclipse","step":[{"@type":"HowToStep","name":"Step 1) Click on 'Distribution ZIP' for jBPM Integration","text":"Go to https://www.drools.org/download/download.html and click 'Distribution ZIP' for jBPM Integration. Once downloaded, extract it to your hard drive.","image":"https://www.guru99.com/images/1/072419_0612_DroolsTutor2.png","url":"https://www.guru99.com/drools-tutorial.html#step1"},{"@type":"HowToStep","name":"Step 2) Install New Software","text":"In Eclipse, select Install New Software.","image":"https://www.guru99.com/images/1/072419_0612_DroolsTutor3.png","url":"https://www.guru99.com/drools-tutorial.html#step2"},{"@type":"HowToStep","name":"Step 3) Click on Add button","text":"Click on Add button for adding a software.","image":"https://www.guru99.com/images/1/072419_0612_DroolsTutor4.png","url":"https://www.guru99.com/drools-tutorial.html#step3"},{"@type":"HowToStep","name":"Step 4) Browse Folder","text":"In the next screen, click on Local and Select folder 'org.drools.updatesite/' then Click Ok.","image":"https://www.guru99.com/images/1/072419_0612_DroolsTutor5.png","url":"https://www.guru99.com/drools-tutorial.html#step4"},{"@type":"HowToStep","name":"Step 5) Click on the Next button","text":"On the install remediation page, click on the Next button.","image":"https://www.guru99.com/images/1/072419_0612_DroolsTutor6.png","url":"https://www.guru99.com/drools-tutorial.html#step5"},{"@type":"HowToStep","name":"Step 6) Accept the license agreement","text":"Accept the license agreement and click next.","image":"https://www.guru99.com/images/1/072419_0612_DroolsTutor7.png","url":"https://www.guru99.com/drools-tutorial.html#step6"},{"@type":"HowToStep","name":"Step 7) Reboot Eclipse","text":"The software will download, and you will be asked to reboot eclipse.","url":"https://www.guru99.com/drools-tutorial.html#step7"},{"@type":"HowToStep","name":"Step 8) Installation process complete","text":"n Windows &gt; Preferences menu, you will see the Drools option indicating it\u2019s installed.","image":"https://www.guru99.com/images/1/072419_0612_DroolsTutor8.png","url":"https://www.guru99.com/drools-tutorial.html#step8"}]},{"@type":"FAQPage","mainEntity":[{"@type":"Question","name":"Is Drools free and open source?","acceptedAnswer":{"@type":"Answer","text":"Yes. Drools is released under the Apache License 2.0 and is completely free and open source. It runs on any JVM and is available through the Maven Central Repository for easy project integration."}},{"@type":"Question","name":"What language are Drools rules written in?","acceptedAnswer":{"@type":"Answer","text":"Drools rules are written in DRL (Drools Rule Language), a declarative syntax based on the when-then structure. Rules can also be authored using decision tables, DMN models, or domain-specific languages for business users."}},{"@type":"Question","name":"How does a rule engine differ from a traditional if-else approach?","acceptedAnswer":{"@type":"Answer","text":"A rule engine externalizes logic into maintainable rules that change without redeploying the application. Hard-coded if-else logic is scattered through the codebase, harder to update, and does not scale well as the number of conditions grows."}},{"@type":"Question","name":"How does Drools relate to AI and expert systems?","acceptedAnswer":{"@type":"Answer","text":"Drools implements expert systems, a classic branch of AI, by encoding human knowledge as rules. The engine reasons over facts to reach conclusions, supporting forward and backward chaining similar to symbolic AI decision systems."}},{"@type":"Question","name":"Can AI help generate or optimize Drools rules?","acceptedAnswer":{"@type":"Answer","text":"Yes. AI assistants can draft DRL rules from plain-language requirements, detect conflicting or redundant rules, and suggest optimizations. Teams still validate the generated rules to ensure correct business logic and reliable execution."}}]}],"@id":"https://www.guru99.com/drools-tutorial.html#schema-48942","isPartOf":{"@id":"https://www.guru99.com/drools-tutorial.html#webpage"},"publisher":{"@id":"https://www.guru99.com/#organization"},"inLanguage":"en-US","mainEntityOfPage":{"@id":"https://www.guru99.com/drools-tutorial.html#webpage"}}]}
```
