O'Reilly logo

Drools JBoss Rules 5.X Developer's Guide by Michal Bali

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 2. Writing Basic Rules

In this chapter we'll start writing our first rules in Drools. We'll go through some basics needed to write and execute rules. We'll learn the necessary keywords of the Drools rule language.

But before all this we have to set up our development environment. If you haven't already done so, please refer to Appendix A, Setting up the Development Environment, on development environment setup.

Rule basics

We'll now write our first Drools rule. Let's say that we have the Account bean that has one property called balance. For every Account bean whose balance is less than 100, we want to write a message to the standard output:

package droolsbook; rule "basic rule" when Account( balance < 100 ) // condition then System.out.println("Account ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required