JBoss Drools Business Rules


JBoss Drools Business Rules
eBook: $29.99
Formats: PDF, PacktLib, ePub and Mobi formats
$25.49
save 15%!
Print + free eBook + free PacktLib access to the book: $79.98    Print cover: $49.99
$49.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Overview
Table of Contents
Author
Reviews
Support
Sample Chapters

 

  • An easy-to-understand JBoss Drools business rules tutorial for non-programmers
  • Automate your business processes such as order processing, supply management, staff activity, and more
  • Prototype, test, and implement workflows by themselves using business rules that are simple statements written in an English-like language
  • Discover advanced features of Drools to write clear business rules that execute quickly
  • For confident users of Excel or other business software, this book is everything you need to learn JBoss Drools business rules and successfully automate your business.

Book Details

Language : English
Paperback : 304 pages [ 235mm x 191mm ]
Release Date : April 2009
ISBN : 1847196063
ISBN 13 : 9781847196064
Author(s) : Paul Browne
Topics and Technologies : All Books, Enterprise Products and Platforms, Java, JBoss, Open Source

Back to BOOK PAGE

Table of Contents

Preface
Chapter 1: Drooling over JBoss Rules
Chapter 2: Getting the software
Chapter 3: Meet the Guvnor
Chapter 4: Guided Rules with the Guvnor
Chapter 5: From Guvnor to JBoss IDE
Chapter 6: More rules in the JBoss IDE
Chapter 7: Testing your Rules
Chapter 8: Data and Rules in Excel
Chapter 9: Domain Specific Language (DSL) and RuleFlow
Chapter 10: Deploying Rules in Real Life
Chapter 11: Looking under the Cover
Chapter 12: Advanced Drools Features
Index
  • Chapter 1: Drooling over JBoss Rules
    • Who are you? What's your problem?
      • Does this sound like where you work?
    • Life or death business rules
      • What would you do?
    • Business rules in your organization
      • Exercise — rules in your organization
      • The chocolate factory
      • Build your own rule engine in Excel
      • Why can't the tech guys write the rules for me?
    • Why existing solutions don't cut it
    • Rule engines to the rescue
      • Other rules (Microsoft Outlook)
    • Meet JBoss Rules
      • A bit more on open source
      • The JBoss Rules community
        • Where to get help
        • How to ask for help
    • The bigger picture
      • Members of your team
    • How do I write the rules
    • Introducing the BRMS (Guvnor)
    • Parts of the solution
      • Rules editor
      • Rules compiler
      • Runtime
      • Fact model
      • Java
      • Rule repository
      • Rest of the system
    • When not to use a rule engine
    • Summary
  • Chapter 2: Getting the software
    • What are we going to install?
      • Who should install it?
      • Installing Java
      • Installing JBoss
        • Actual install
      • Installing the BRMS/Guvnor
      • Installing Eclipse
      • Installing the Drools plug-in
        • Finding the plug-in
      • Installing Maven
      • Installing sample projects for this book
        • Setting up the sample project in Eclipse
        • Getting Maven and Eclipse to work together
      • Troubleshooting
    • Summary
  • Chapter 3: Meet the Guvnor
    • Taking a tour with the Guvnor
      • Getting started
      • General navigation
        • The search screen
      • Administration
        • Loading the samples
        • What did we just do?
        • More on the admin page
        • Rules
        • Packages
        • Deployment
        • QA—Quality Analysis
        • Hello World example
    • Summary
  • Chapter 4: Guided Rules with the Guvnor
    • Passing information in and out
    • Building the fact model
    • Importing the fact model into Guvnor
      • Guided rules using the fact model
      • The step-by-step answer
    • Running this scenario
    • What just happened?
  • Summary
  • Chapter 5: From Guvnor to JBoss IDE
    • A more powerful rule
      • Have a go
      • Updating the rule—step by step
        • The When part
        • Looking behind the curtain—a text-based rule
      • A small problem...
        • Rule attributes
      • More on the guided editor
        • Possible comparisons
        • Condition types
        • Add more options
        • Multiple field constraints
        • The Then part
        • More rule options and attributes
      • Text editing
      • Introduction to the JBoss IDE
      • Hello World in the JBoss IDE editor
        • What just happened?
      • Try it yourself
    • Summary
  • Chapter 6: More rules in the JBoss IDE
    • Rule syntax
      • Patterns for the When part
      • Patterns for the Then part
      • Shipping chocolate bars
      • The problem (and remind me why I need business rules)
        • Why rules scale better—a reminder
      • Getting and building the sample
        • Rules
        • ChocolateShipment.java
        • CustomerOrder.java
        • OompaLoompaDate
        • The RuleRunner file
        • MultipleRulesExample
      • Running the sample
        • Console
      • More powerful rule syntax
        • Lefthand side
        • Righthand side—Then
      • Guided editor in the JBoss IDE
    • Summary
  • Chapter 7: Testing your Rules
    • Testing when building rules
      • Making testing interesting
      • Testing using Guvnor
      • Testing using FIT
        • Getting FIT
        • The FIT requirements document
        • Running FIT on our sample
        • What just happened?
        • What can go wrong?
      • The FIT plumbing
      • What is unit testing?
        • Why unit test?
        • Unit testing the Chocolate Shipments sample
        • What just happened?
      • What if it goes wrong?
        • Failures and errors
        • Testing an entire package
    • Summary
  • Chapter 8: Data and Rules in Excel
    • Reading data from Excel
      • Business rules for this sample
      • Getting and running the sample
        • Input
        • Rules
        • Running the sample
        • What's going on?
        • Under the covers
        • More on Cells and Ranges
      • Sophisticated, but repetitive rules
      • Some Excel magic
      • Decision tables behind the scenes
        • Header information
        • RuleTable—Evaluate the buy trades
        • RuleTable—Execute the buy trades
        • Other rule tables
        • Mixing rules and decision tables
      • Running the Chocolate Trading example
        • What just happened?
        • Have a go
    • Summary
  • Chapter 9: Domain Specific Language (DSL) and RuleFlow
    • What is a Domain Specific Language (DSL)?
      • Expanders
        • The DSL format
        • Other DSL editing options
        • Writing DSLs
        • Meet the sample
      • Running the DSL example
        • Guvnor and DSL-based rules
    • Ruleflow
      • Ruleflow is not workflow
      • That Homeloan example again
    • Linking rules to Ruleflow
    • A quick introduction to stateful applications
      • Stateful rules and Ruleflow
  • Summary
  • Chapter 10: Deploying Rules in Real Life
    • One size fits all architecture
      • What needs to be deployed?
      • Rules as code or data?
    • Deployment process
      • What's a repository?
    • Deploying rules
    • Push or pull?
    • Loading our rules
      • Looking inside RuleRunner.java
      • Helper methods
    • Public methods
      • Stateless
      • Stateful
    • Alternative method—RuleAgent
    • Web deployment
      • Maven for packaging
  • Summary
  • Chapter 11: Looking under the Cover
    • Rule engine concepts
      • Facts or objects
      • Working memory
      • Pattern matching, Agenda, and Activations
      • Conflict resolution
      • A more dynamic Agenda
      • Truth maintenance
    • Back to the future (with chocolate shipping)
    • Logging working memory
      • Looking at the working memory log
      • Drools Audit Log Viewer
    • Rete algorithm
      • Rete in action
      • Debugging rules
        • Debugging rules in the Eclipse IDE
        • Rules debug perspective
        • Other Drools views while debugging
      • When to log, when to test, and when to debug
    • Summary
  • Chapter 12: Advanced Drools Features
    • Pigeons, Drools, and Complex Event Processing
      • Implementing Complex Event Processing using Fusion
      • More powerful events
    • Inline beans
      • Loading data when your beans don't exist—Smooks
    • From pigeons to biscuits—Drools Solver for your local supermarket
      • How Drools Solver works
        • Implementing a Solver
        • More information on Solver
      • Forward and backward chaining
      • Changing the conflict resolution methodology
      • Standard rule engine API—JSR 94
        • Other rule engines
    • New API
      • Drools flow—a full workflow engine
      • New features in Guvnor
      • Does this still sound like where you work?
    • Summary
Back to BOOK PAGE

Paul Browne

Paul Browne's first job was selling computers in France and things went steadily downhill from there. He spent millons on behalf of a UK telephone company's procurement department and implemented direct marketing for a well-known Texan computer maker before joining the IT department of a company that builds bright red tractors and other seriously cool machines.

Paul then embraced his techie side (he was writing games in machine code from the age of 11) and started a consultancy that used IT to solve business problems for companies in the financial and public sectors in Ireland, UK , Belgium, and New Zealand. Eight years later, he now works with an Irish government agency that helps similar software companies to grow past their initial teething pains.

More formally, Paul has a bachelor's degree in Business and French from the University of Ulster, a master's degree in Advanced Software from UCD Dublin, a post-grad qualification in Procurement from the Chartered Institute of Procurement and Supply (UK), and will someday complete his ACCA financial exams.

Paul can be found on LinkedIn at http://www.linkedin.com/in/paulbrowne , and via the Red Piranha (Business knowledge) project at http://code.google.com/p/red-piranha/ .

Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


Errata

- 1 submitted: last submission 10 Sep 2012

Errata type: Cover| Page number:0

In the back cover, change the last Paragraph : This book will teach you to specify business rules by using JBoss Drools, and then put them into action in your business. You will be able to create rules that trigger actions and decisions, based on data that comes from a variety of sources and departments across your business.Whatever size business you are working with, you can make your processes more effective and manageable by adopting JBoss Rules. to This book will suit your need if you are a business user who wants to write rules, or a business analyst, or a technical person who needs to support rules, or looking for an introduction to rule engine technology. This book is for you if you are a want to understand what Drools can do and how it works, but would rather leave the implementation to a developer, or are the developer doing the actual implementation.

 

Errata type:Cover | Page number: 0

Last Bullet Point in back cover, change: How to write sophisticated rules, import the fact model into the Guvnor, and then build a guided rule around it, which makes your web pages a lot clearer. to Learn how to write sophisticated rules and import data into the Guvnor Rule editor and then build a guided rule around it, which makes your web pages a lot clearer.

 

Errata type:Foreword | Page number:5

Remove the following text from the Foreword: Bob is also employed at JBoss, but has since moved onto other Ruby-based endeavours.

 

Errata type:Other | Page number:57

If you have any problems ... then run the Run the command ... 'Run the' should be removed

 

Errata type: Other| Page number: 119

way of wiring the same ... should be 'writing'

 

Errata type:Other | Page number:133

The line :For convenience, we have put it into one file called RuleRunner.java. Change RuleRunner.java to SimpleRuleRunner.java

 

Errata type:Code error | Page number: 226

The command: mvn jetty:runwar Should be: mvn jetty:run-war

 

Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

JBoss Drools Business Rules +    Programming Microsoft® Dynamics™ NAV =
50% Off
the second eBook
Price for both: £23.30

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

 

  • Understand the basics of business rules and JBoss rules with minimal effort
  • Install the required software easily and learn to use the Guvnor, which is a user-friendly web editor that's also powerful enough to test our rules as we write them
  • Learn to write sophisticated rules and import the fact model into the Guvnor and then build a guided rule around it, which makes your web pages a lot clearer
  • Gain complete knowledge of what we can do with the Guvnor rule editor, and then use the JBoss IDE as an even more powerful way of writing rules, and automate processes for discounts, orders, sales, and more
  • Know the structure of the rule file through the example of a shipping schedule, which will help you with your own shipping schedule
  • Test your rules not only in the Guvnor, but also using FIT for rule testing against requirements documents; run unit tests using JUnit for error-free rules and interruption-free services
  • Specifically, non-developers can work with Excel spreadsheets as a fact model to develop business processes without learning any other new technology
  • Work with DSLs (Domain-Specific Languages) and rule flow to make writing rules easy; which makes staff training quicker and your working life easier
  • Deploy your business rules to the real world, which completes your project successfully, and combine this into a web project using the framework of your choice to provide better services
  • Benefit from concepts such as truth maintenance, conflict resolution, pattern matching rules agenda, and the Rete algorithm to provide advanced and faster business systems so that staff efficiency is maximized

Chapter 1, Drooling over JBoss Rules. This chapter gives you a good platform to understand business rules and JBoss rules. We look at the problems that you might have (and why you're probably reading this book). We look at what business rule engines are, and how they evaluate business rules that appear very simple and how they become powerful when multiple rules are combined.

Chapter 2, Getting the software, deals with installation. This chapter explains setting up Java, setting up Business Rule Management System (BRMS)/Guvnor running on the JBoss App Server, setting up Eclipse, and installing the Drools Plug-in. It also details the installation of the Drools examples for this book and the Maven to build them.

Chapter 3, Meet the Guvnor, deals with writing our rules using the 'Guvnor'. Guvnor is the user-friendly web editor that's also powerful enough to test our rules as we write them. We take up an example to make things easier. Then we look at the various Guvnor screens, and see that it can not only write rules (using both guided and advanced editors), but that it can also organize rules and other assets in packages, and also allow us to test and deploy those packages. Finally, we write our very first business rule—the traditional 'Hello World' message announcing to everyone that we are now business rule authors.

Chapter 4, Guided Rules with the Guvnor. This chapter shows how to use the Guvnor rule editor to write some more sophisticated rules. It also shows how to get information in and out of our rules, and demonstrates how to create the fact model needed to do this. We import our new fact model into the Guvnor and then build a guided rule around it. Finally we test our rule as a way of making sure that it runs correctly.

Chapter 5, From Guvnor to JBoss IDE. This chapter pushes the boundries of what we can do with the Guvnor rule editor, and then brings in the JBoss IDE as an even more powerful way of writing rules. We start by using variables in our rules example. Then we discuss rule attributes (such as salience) to stop our rules from making changes that cause them to fi re again and again. After testing this successfully, we look at text-based rules, in both the Guvnor and the JBoss IDE, for running 'Hello World' in the new environment.

Chapter 6, More Rules in the jBoss IDE. This chapter looks again at the structure of a rule fi le. At the end of this chapter, we look at some more advanced rules that we can write and run in the IDE.

Chapter 7, Testing your Rules. This chapter explains how testing is not a standalone activity, but part of an ongoing cycle. In this chapter we see how to test our rules, not only in the Guvnor, but also using FIT for rule testing against requirements documents. This chapter also explains Unit Testing using JUnit.

Chapter 8, Data in Excel, Rules in Excel. This chapter explains how to use Excel Spreadsheets (cells and ranges) as our fact model to hold information, instead of the write-your-own-JavaBean approach we took earlier. Then we use Excel spreadsheets to hold Decision tables, to make repetitive rules easier to write.

Chapter 9, Domain-Specific Languages [DSL] and rule flow. This chapter aims to make our rules both easier to use, and more powerful. We start with DSLs—Domain-Specifi c Languages. This chapter follows on from the 'easy to write rules' theme from the previous chapter and also discusses both ruleflow and workflow. It would be great to draw a workfl ow diagram to see/control what (groups of) rules should fi re and when. Rule flow gives us this sort of control.

Chapter 10, Deploying rules in real life. This chapter shows you how to deploy your business rules into the real world. We look at the pieces that make up an entire web application, and where rules fit into it. We see the various options to deploy rules as part of our application, and the team involved in doing so. Once they are deployed, we look at the code that would load and run the rules—both home-grown and using the standard RuleAgent. Finally we see how to combine this into a web project using the framework of your choice.

Chapter 11, Peeking under the covers. This chapter looks at what happens under the cover by opening up the internals of the Drools rule engine to understand concepts such as truth maintenance, confl ict resolution, pattern matching, and the rules agenda. In this chapter, we explore the Rete algorithm and discuss why it makes rules run faster than most comparable business logic. Finally we see the working memory audit log and the rules debug capabilities of the Drools IDE.

Chapter 12, Other Drools features. This chapter deals with the other advanced Drools features that have not yet been covered. This includes Smooks to bulk load data, Complex Event Processing, and Drools solver to provide solutions where traditional techniques would take too long.

In Detail

In business, a lot of actions are trigged by rules: "Order more ice cream when the stock is below 100 units and temperature is above 25° C", "Approve credit card application when the credit background check is OK, past relationship with the customer is profitable, and identity is confirmed", and so on. Traditional computer programming languages make it difficult to translate this "natural language" into a software program. But JBoss Rules (also known as Drools) enables anybody with basic IT skills and an understanding of the business to turn statements such as these into running computer code.

This book will teach you to specify business rules using JBoss Drools, and then put them into action in your business. You will be able to create rules that trigger actions and decisions, based on data that comes from a variety of sources and departments right across your business. Regardless of the size of your business, you can make your processes more effective and manageable by adopting JBoss Rules.

Banks use business rules to process your mortgage (home loan) application, and to manage the process through each step (initial indication of amount available, actual application, approval of the total according to strict rules regarding the amount of income, house value, previous repayment record, swapping title deeds, and so on).

Countries such as Australia apply business rules to visa applications (when you want to go and live there)—you get points for your age, whether you have a degree or masters, your occupation, any family members in the country, and a variety of other factors.

Supermarkets apply business rules to what stock they should have on their shelves and where—this depends upon analyzing factors such as how much shelf space there is, what location the supermarket is in, what people have bought the week before, the weather forecast for next week (for example, ice cream in hot weather), and what discounts the manufacturers are giving.

This book shows how you can use similar rules and processes in your business or organization. It begins with a detailed, clear explanation of business rules and how JBoss Rules supports them.

You will then see how to install and get to grips with the essential software required to use JBoss Rules. Once you have mastered the basic tools, you will learn how to build practical and effective of the business rule systems.

The book provides clear explanations of business rule jargon. You will learn how to work with Decision Tables, Domain-Specifi c Languages (DSL)s, the Guvnor and JBoss Integrated Development Environment (IDE), workflow and much more.

By the end of the book you will know exactly how to harness the power of JBoss Rules in your business.

A comprehensive, practical guide for business analysts and non-programmers to harnessing JBoss Drools Business Rules in your organization

Approach

This book takes a practical approach, with step-by-step instructions. It doesn't hesitate to talk about the technologies, but takes time to explain them (to an Excel power-user level). There is a good use of graphics and code where necessary.

Who this book is for

If you are a business analyst – somebody involved with enterprise IT but at a high level, understanding problems and planning solutions, rather than coding in-depth implementations – then this book is for you.

If you are a business user who needs to write rules, or a technical person who needs to support rules, this book is for you.

If you are looking for an introduction to rule engine technology, this book will satisfy your needs.

If you are a business user and want to write rules using Guvnor/JBoss IDE, this book will be suitable for you.

This book will also suit your need if you are a business user and want to understand what Drools can do and how it works, but would rather leave the implementation to a developer.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software