DROOLS is a business rule management system (BRMS) . It have a forward chaining inference based rules engine known as a production rule system, using enhanced Rete algorithm. DROOLS run only on Java platform. This article provides an insight into various DROOLS features and its use. Major components of DROOLS are
- Drool Expert (Rule Engine)
- Drool Guvnor (BRMS/BPMS)
- Drool Flow (Workflow)
- Drool Fusion (Reasoning)
Before getting into major components of DROOLS, let have a look common terminologies associated with business rule management systems.
Facts are the knowledge of DROOLS. Facts are plain old java objects (POJO) where data for rules are stored.
Facts are placed in working memory which will be used for pattern matching at later stage. A user can retrieve, insert or modify facts.
Rules are a piece code which contain business logic's
A business rules engine is a software system. Rule engine executes multiple business rules in a production environment. Rule engine have a Inference Engine,production and working memory. Businesses rule are put into production memory. Facts (Data) is placed in working memory. Inference engine matches facts against each rule in the production memory. Inference Engine uses Linear, Rete, Treat or Leaps algorithm for pattern matching. DROOLS uses extended Rete Algorithm, ReteOO for pattern matching. When many rules becomes true for same fact, it creates conflict. Agenda uses Conflict Resolution strategy to manage the execution. Rule engine architecture is as shown below
Advantages of drools are
- Logic and data separation
- Declarative programming
- Centralization of knowledge
- Understandable rules
One of the most common questions which comes to the mind of an architect/developer is when to use drools. DROOLS should be used when there is an often change in business logic, problem is beyond any obvious algorithm based solution, problem is just too fiddle for traditional code and when we have nontechnical Domain experts.
Drools Expert is split into run time and authoring . Authoring involves creation of DROOL file (DRL/XML). Rulebase is the run time component of DROOLS which consists of many packages. Rulebase is used to instantiate working memories.
Guvnor is a web based utility used to edit and mange drools. We should use guvnor when multiple user need to edit rules or when we need have a version management for rules. Guvnor is used by Business Analyst, Rule expert and Developer.
DROOLS Flow is used to integrate process and rules. Users can create work flows using this utility. In a work flow we can configure the order in which different tasks/rules need to be executed.