Library / Documentation
Drools documentation
Documentation for a widely used open-source business rules engine.
By Drools community · Drools (KIE) · Added 2026-10-12
All content belongs to Drools community / Drools (KIE). We only link to it and give credit. Report a problem
Learn this doc
About 30 min left. Your work is saved as you go.
What you want from these docs
Drools (KIE) documents a tool you may use. Decide what you want to do with it, then read only what answers that.
Ideas you will meet
- Event Driven Architecture
- Loosely coupled services reacting to events.
What we already know about this
Our own lessons on these ideas. Read them here before you start, so it makes sense.
Storage, Queues and Real-time · 11 minA rule engine and trigger frameworkMatch product events against versioned rules and run actions safely: rule shape, evaluation, idempotent actions, rate limits, testing and audit.Read here
What it is
A rule engine (or trigger framework) lets you say "when this happens and if these conditions hold, do that", without writing a new code path each time. Examples: send a welcome message when a user signs up, flag an order when the amount is unusual, award a badge after five purchases.
Product and operations teams want to change these often, so the rules should be data that a service evaluates, not code that must be redeployed.
100%Figure SDA-SQR-04-1 · From event to action · © forcsguy.com
What a rule contains
- Identity and version:
id,version,owner,enabled. Never edit in place; publish a new version so you can audit and roll back. - Trigger: an event type, or a schedule for time-based rules.
- Condition: a structured tree such as
all of [ plan = free, country in (IN, US), purchases >= 5 ], or a restricted expression language. Avoid arbitrary code. - Action: a named action with parameters (
send_email(template_id),add_badge(name)). - Controls: cooldown, per-user and global limits, start and end dates.
Evaluating efficiently
- Index rules by event type so an event only looks at its few candidate rules, not all rules.
- Fetch extra user data (attributes, counters) lazily and cache it for the duration of the event, as lookups usually cost more than the comparisons.
- For time-based conditions ("14 days without login") run a scheduled scan or use delayed events, rather than polling every user.
- Evaluate in workers that are partitioned by user, so state like cooldowns and counters for one user is handled in order.
Safe, idempotent actions
Events can be delivered more than once and workers retry. Guard every action with an idempotency key, for example
rule:version:user:window, stored in a unique-key table or key-value store before (or together with) performing the action.100%Figure SDA-SQR-04-2 · Idempotent action execution · © forcsguy.com
Operating a rule engine
- Validation at publish time: reject unknown fields, huge conditions and loops.
- Dry run and replay: run a new rule against recent historical events and report how many it would fire, before enabling it.
- Kill switch per rule and globally, since a bad rule can email a million users.
- Limits: maximum rule size, evaluation time and actions per event.
- Audit: who changed which version and when; for each event, which rules fired or were skipped and why.
- Know the cost: a large pile of rules becomes software nobody understands. Fowler's advice is to prefer plain code for logic that rarely changes, and use rules for what truly varies.
Real-world reading
- Identity and version:
Go deeper on this
A path through videos, articles, other case studies and code on the same ideas as Drools documentation.
Warm upGet the vocabulary first.
Books · Free from the author
Designing Event-Driven Systems
Event sourcing, CQRS and using event streams as the source of truth, with Kafka. A free ebook from the author and Confluent.
ConfluentIntermediate
Books
Microservices Patterns
Patterns for decomposing, communicating and deploying microservices, including sagas and event sourcing.
ManningIntermediate
WatchHow others solve the same problem, on video.
Videos belong to their creators and play from YouTube. More on YouTube (opens in a new tab)
ReadEngineers explain it in their own words.
Papers
Kafka - Message Broker
Apache Kafka is a scalable message broker , and Apache Samza is a stream processing framework built upon Kafka. They are widely used as infrastructure for implementing personalized online services and real-time predic...
KleppmannIntermediate
Blogs
Confluent Blog
Kafka design, event streaming patterns and stream processing.
ConfluentIntermediate
See it in another companyThe same ideas, a different system.
Case Studies · Read here
Brooklin: Distributed Service for Near Real-Time Data Streaming at LinkedIn
Brooklin—a distributed service for streaming data in near real-time and at scale—has been running in production at LinkedIn since 2016, powering thousands of data streams and over 2 trillion messages per day. Today, w...
LinkedInIntermediate
Case Studies · Read here
Delaying Asynchronous Message Processing with RabbitMQ at Indeed
By implementing a delay queue for our message processing, we improved the resilience of our internal systems and were able to deliver jobs more reliably.
IndeedIntermediate
Read the codeSee how it looks when it is real.
GitHub
Awesome Microservices
Curated tools, frameworks and reading material for building microservice systems.
mfornosIntermediate
GitHub
NATS Server
A lightweight, high-performance messaging system.
CNCF / NATSIntermediate
Keep learning
Loading community…