Modifying the data in the working memory

In the previous chapters, we've already seen the basic structure for a business rule: conditions and actions. When a specific set of conditions defined in a rule are met, we trigger specific actions defined in that rule. So far, these actions have only been basic modifications of Java beans or system logs. However, the Drools rule language allows us to do much more.

When a rule becomes too complex or it comprises of multiple complex conditions, defining them in one single rule might not be the best way to go. In imperative programming (such as Java and C++), we would break down a method or function, which is complex, into many smaller, simpler methods. In Drools, we should follow a similar structure defining ...

Get Mastering JBoss Drools 6 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.