JBoss Drools is an open source project that is always in a continuous evolution adding more modules and features to the existing ones. This evolution is possible, thanks to the vision of the core developers and the open source community that is continuously pushing it to a new level. And since version 5, Drools has been evolved to provide a unified platform for business rules, business processing, event processing, and automated planning.
With this book you will learn new features to create a robust business rules implementation, starting with tips to write business rules and ending with frameworks integration to create a full business rules solution. The recipes included in this book cover all the Drools modules and will help you to learn how your business rules can be integrated with other frameworks to create a full solution, and will also help you discover how to use complex features such as complex event processing, remote execution, declarative services, and more.
Chapter 1, Expert: The Rule Engine, will introduce you to new features available in the 5.2.0 release and in the previous releases to improve your expertise with the main Drools module.
Chapter 2, Expert: Behind the Rules, will cover more recipes for Drools Expert, and you will learn different ways to persist the knowledge and the use of the Drools Verifier project. You will also learn how to monitor Drools using JMX, and so on.
Chapter 3, Guvnor: Centralized Knowledge Management, contains recipes that use the Drools Guvnor as your knowledge repository using new authoring methods.
Chapter 4, Guvnor: Advanced Features and Configuration, will teach you how to back up and configure the rules repository in order to use an external database, how to interact with Guvnor using the REST API, and so on.
Chapter 5, Fusion: Processing Complex Events, will get you started with the Complex Event Processing (CEP) and Drools Fusion concepts to add event processing capabilities to your project.
Chapter 6, Executing Drools Remotely, will introduce to you all the concepts and requirements needed to use and test the Drools Server module to execute your business rules remotely using the HTTP protocol, which will enable you to interact with it using different programming languages.
Chapter 7, Integration: How to Connect Drools, covers all the possible integrations between Drools, the Spring Framework, and Apache Camel to create declarative services.
Chapter 8, Planner: Optimizing Your Automated Planning, will teach you how to optimize automated planning problems using the Drools Planner module, covering a step-by-step explanation of the configuration possibilities and how to benchmark it to improve your solution.
Chapter 9, jBPM5: Managing Business Processes, will show you how to use some features of the new jBPM5 project, such as BPMN2 process creation using the API, and testing, monitoring, and report creation.
The recipes in this cookbook assume that you know the Java language pretty well and also that you have basic JBoss Drools knowledge. The latter is really important because the basic business rules authoring process and concepts aren't the main focus and we are going straight ahead into the recipes. If you do not have basic knowledge of JBoss Drools, you should consider reading Drools JBoss Rules 5.0 Developer's Guide, published by Packt, before this book. Also, you will have to know how to create Apache Maven projects to follow the recipes, and it is recommended to know about frameworks such as the Spring Framework, Apache Camel, Hibernate, and so on. However, if you don't know them don't worry because they will be minimally explained in the recipes.
Java JDK 1.5 or higher (Oracle Java JDK 1.6 is recommended)
Apache Maven 3.x
Java IDE (Eclipse + Apache Maven plugin, Netbeans, IntelliJ IDEA or any other plugin with Apache Maven integration)
This book is for experienced Java developers and architects who want to improve their current knowledge about the JBoss Drools project and also want to discover new features that can be applied in their projects.
In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text are shown as follows: "This method returns an org.drools.definition.type.FactType
object that is used to communicate with the KnowledgeBase
in order to create instances of your facts."
A block of code is set as follows:
package drools.cookbook; import drools.cookbook.model.FlightStatus import drools.cookbook.model.FlightControl global drools.cookbook.model.FlightControl control; declare FlightStatus @role(event) @timestamp(timestamp) end
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
WorkingMemoryEntryPoint flightArrivalEntryPoint = ksession
.getWorkingMemoryEntryPoint("flight-arrival");
flightArrivalEntryPoint.insert(flightStatus);
clock.advanceTime(7, TimeUnit.MINUTES);
Any command-line input or output is written as follows:
Error: Restriction LiteralRestriction from rule [rule 2] value '== 2' and LiteralRestriction from rule [rule 2] value '!= 2'are in conflict. Because of this, pattern that contains them can never be satisfied. type: INCOHERENCE on: Pattern, name: Server
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "clicking the Next button moves you to the next screen".
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to <[email protected]>
, and mention the book title via the subject of your message.
If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or e-mail <[email protected]>
.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <[email protected]>
with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
You can contact us at <[email protected]>
if you are having a problem with any aspect of the book, and we will do our best to address it.