What this book covers
Chapter 1, Rules Declarative Nature, talks about what the reader will need to understand about rules to apply them to a project of their own. In short, it will cover the main structure of rules and why said structure is so useful for solving complex problems, along with some of the problems usually solved using rules. Also, we'll explain how rules adjust within the development life cycle.
Chapter 2, Writing and Executing Rules, concentrates on creating a project with rules defined in a simple text file in order to understand both the basic components of rules and all the parts involved in a Drools rule project. This chapter also covers the basics of installing the necessary libraries to work with Drools in a project.
Chapter 3, Drools Runtime, concentrates on the KIE modules (Knowledge Is Everything modules) that are needed to create a rule environment and how to use them to create a rule runtime. All the different ways of creating a runtime for rules are introduced in this chapter.
Chapter 4, Improving Our Rule Syntax, teaches the concepts we need to understand the basic technical syntax used to define Business Rules in Drools. This chapter concentrates on learning about rule attributes, such as salience
, lock-on-active
, agenda-groups
, and so on, which give a lot more control over which rules are to be fired and when. Also, we'll learn about the from
clause of rules, which allows for different sources of data for evaluating our rule conditions.
Chapter 5, Understanding KIE Sessions, starts with an introduction to the different types of session supported by Drools. It then covers many of the different components that can be added to the session to make it register, alter, or change our rules execution, such as global variables, channels, event listeners, operators, and accumulate functions.
Chapter 6, Complex Event Processing, gives a brief introduction to the Complex Event Processing (CEP) concept and how Drools allows us to work with complex events. It covers features such as events, type declarations, temporal operators, sliding windows, and other components of Drools for detecting and managing complex events.
Chapter 7, Human Readable Rules, explains human readable ways to define our rules, such as Domain Specific Language (DSL), Decision Tables, and Templates. They allow the user to create a mapping between the rule language (highly technical) and the specific language that domain experts can easily understand. These mappings will allow business users to be able to define and modify rules without much knowledge of the technical aspects of Drools.
Chapter 8, Rules Testing and Troubleshooting, explains what the different challenges of testing Drools' rules are. It gives an overview of the possible errors and problematic scenarios we may find when testing our application. A set of good practices and techniques to identify and mitigate these problems is also provided in this chapter.
Chapter 9, Introduction to PHREAK, is an introduction to the underlying algorithm Drools uses for the evaluation of business rule assets. It provides an overview of how a Knowledge Base is converted into a PHREAK network composed of specialized nodes that perform different kinds of task, such as classification, constraint evaluation, and join operations. This chapter provides concrete examples on how rules are compiled and evaluated, covering some of the most used patterns and operators in PHREAK.
Chapter 10, Integrating Rules and Processes, goes into detail about the workflow aspect of rules. Specifically, it covers how rules can invoke processes and vice versa. In this chapter, we will also cover the aspects required for implementing a persistent Kie Session, to be used (and reused) both for Rules and for Processes execution.
Chapter 11, Integrating Drools with our Apps, shows integration with the Spring and Camel frameworks, in order to integrate Drools in more complex applications. It also shows us how to make changes to our rules while the application runs and how to make services to invoke rules remotely, using a component called Kie Execution Server.