Preface

Business rules and processes can help your business by providing a level of agility and flexibility. As a developer, you will be largely responsible for implementing these business rules and processes effectively, but implementing them systematically can often be difficult due to their complexity. Drools makes the process of implementing these rules and processes quicker and handles the complexity, making your life a lot easier!

This book guides you through various features of Drools, such as rules, processes, decision tables, complex event processing, Drools Rete implementation with various optimizations, and others. It will help you to set up the Drools platform and start creating your own business. It's easy to start developing with Drools if you follow our real-world examples that are intended to make your life easier.

Starting with an introduction to the basic syntax that is essential for writing rules, the book will guide you through validation and human-readable rules that define, maintain, and support your business agility. As a developer, you will be expected to represent policies, procedures, and constraints regarding how an enterprise conducts its business; this book makes it easier by showing you the ways in which it can be done.

A real-life example of a banking domain allows you to see how the internal workings of the rules engine operate. A loan approval process example shows the support of processes within Drools. Parts of a banking fraud detection system are implemented with the Drools Fusion module, which is the complex event processing part of Drools. This, in turn, will help developers to work on preventing fraudulent users from accessing systems in an illegal way.

Finally, more technical details are shown on the inner workings of Drools, the implementation of the ReteOO algorithm, indexing, and node sharing.

What this book covers

Chapter 1, Programming Declaratively, introduces the reader into the domain of business rules and business processes. It talks about why standard solutions fail at implementing complex business logic. We will also see a possible solution in the form of a declarative programming model. The chapter talks about its advantages and disadvantages. A brief history of Drools is also mentioned.

Chapter 2, Writing Basic Rules, shows us the basics of working with the Drools rule engine, Drools Expert. It starts with a simple example that is explained step-by-step. It begins with the development environment setup, writing a simple rule and then executing it. The chapter goes through some necessary keywords and concepts that are needed for more complex examples.

Chapter 3, Validating, introduces the reader to a banking domain that will be the basis for examples later in this book. The chapter then goes through an implementation of a decision service for validating this banking domain. A reporting model is designed that holds reports generated by this service.

Chapter 4, Transforming Data, shows how Drools can be used for doing complex data transformation tasks. It starts with writing some rules to load the data, continues with the implementation of various transformation rules, and finally, puts together the results of this transformation. The chapter shows how we can work with a generic data structure such as a map in Drools.

Chapter 5, Creating Human-readable Rules, focuses on rules that are easy to read and change. Starting with domain-specific languages, the chapter shows how to create a data transformation-specific language. Next, it focuses on decision tables as another more user friendly way of representing business rules. An interest rate calculation example is shown, and finally, the chapter introduces the reader to jBPM as a way of managing the rule execution order.

Chapter 6, Working with Stateful Session, talks about executing the validation decision service in a stateful manner. The validation results are accumulated between service calls. This shows another way of interacting with a rule engine. Logical assertions are used to keep the report up-to-date. Moreover, various ways to serialize a stateful session are discussed.

Chapter 7, Complex Event Processing, goes through various features such as events, type declarations, temporal operators, sliding windows, and others. Drools Fusion, another cornerstone of the Drools platform, is about writing rules that react to various events. The power of Drools Fusion is shown on a banking fraud detection system.

Chapter 8, Defining Processes with jBPM, goes into more detail about the workflow aspect of the Drools platform. It is shown on a loan approval service that demonstrates the use of various nodes in a flow. Among other things, the chapter talks about implementing a custom work item, human task, and a subflow.

Chapter 9, Building a Sample Application, shows you how to integrate Drools in a real web application. We'll go through the design and implementation of persistence, business logic, and presentation layers. All examples written so far will be integrated into this sample application.

Chapter 10, Testing, aims to give you an idea of various ways of how to test your business logic. Starting with unit testing, integration testing through acceptance testing will be shown on the business rules management server (Guvnor). The chapter provides useful advice on various troubleshooting techniques.

Chapter 11, Integrating, shows integration with the Spring framework. It describes how we can make changes to rules and processes while the application runs. It shows how to use an external build tool such as Ant to compile rules and processes. It talks about the rule execution server that allows us to execute rules remotely. It also briefly mentions support of various standards.

Chapter 12, Learning about Performance, takes us under the hood of the Drools rule engine. By understanding how the technology works, you'll be able to write more efficient rules and processes. It talks about the ReteOO algorithm, node sharing, node indexing, and left/right unlinking.

Appendix A, Setting Up the Development Environment, lists the various steps required to get you up and running with Drools.

Appendix B, Creating Custom Operator, shows an implementation of a custom operator that can be used to simplify our rules.

Appendix C, Dependencies of Sample Application, lists various dependencies used by the sample application.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.156.250