Sitemap

Java: Drool vs Kogito

2 min readJul 31, 2025

--

Drools is a Business Rule Management System (BRMS) written in Java. It allows you to define, manage, and execute business rules separately from your application code, using a declarative approach.

🔧 What Drools Is Used For

  • Automating decision-making based on complex rules
  • Centralizing business logic for easier management
  • Separating business logic from application logic
  • Supporting forward chaining (data-driven) and backward chaining (goal-driven) inference

🧠 Key Concepts

Press enter or click to view image in full size

🧾 Example Rule (DRL Syntax)

// Person.drl
rule "Is adult"
when
$person : Person(age >= 18)
then
System.out.println($person.getName() + " is an adult.");
end

🏗️ How Drools Fits in a Java App

KieServices ks = KieServices.Factory.get();
KieContainer kContainer = ks.getKieClasspathContainer();
KieSession kSession = kContainer.newKieSession("ksession-rules");

Person john = new Person("John", 25);
kSession.insert(john); // Insert fact
kSession.fireAllRules(); // Evaluate rules

🔍 Use Cases

  • Insurance policy eligibility
  • Loan approval
  • Fraud detection
  • Medical diagnosis
  • Retail discounts or offers

🆚 Compared to If-Else in Code

If-Else in JavaDroolsHard-coded logicExternalized in DRL filesHard to maintainEasier to update by business usersScales poorlyDesigned for complex rule sets

📦 Alternatives

  • Kogito (next-gen version of Drools for cloud-native apps)
  • JBoss Rules (older name for Drools)
  • Camunda, Activiti (more focused on workflows than pure rules)
  • OpenL Tablets, Easy Rules, RuleBook

🧱 Differences

Get Alice Dai’s stories in your inbox

Join Medium for free to get updates from this writer.

Drools is just a rules engine, used to define and run business rules.

Kogito is a platform that combines:

  • Drools (for business rules)
  • jBPM (for workflows and processes)
  • DMN (Decision Model & Notation)
  • Event-driven architecture
  • Native support for Quarkus or Spring Boot microservices
Press enter or click to view image in full size

--

--