Saturday, January 26, 2008

Drools Success Stories - Seattle Code Camp V3.0

Kelvin Meeks just did a presentation for the Seattle Code Camp V3.0, this presentation is available here.

The interesting part is where he quotes his success stories with Drools, so I thought i'd quote that here:
  • "We are using Drools VERY successfuly around 3 years (We started with version 2.x). And it has being so usefull that now we have a very big system running on more than one customer in telecom market.
  • Currently we do have a server running around 300 rules, where we assert millions of facts at once. The objective is to guide and rate telecom usage events. We are able to apply those 300 rules over 20 Milion facts and get results (Guided and Rated) around 1 hour( Note: First we have to read many binary files, perform a charset conversion on data, load it in our object model, assert objects in working memory, apply around 200 rules to enrich the data, assert again in a new working memory, and rate the events accessing external RDBMS databases - caching results of course)."
  • "We tested several deployment and architecture variants (esp. for batch processing), with <100 and <10 facts for each data-row within our batches, but a few million rows. Worked out fine.
  • "We deployed a Drools based solution to a client in the pharmaceutical distribution world (Fortune 100 company :-). We used Drools to power the decisions an interactive voice ordering system. A small number of rules initially but growing constantly


Tuesday, January 22, 2008

Drools and Spring Integration

I've posted a donated drools-spring module to the dev mailing list for feedback on Drools integration with Spring. I've had no feedback yet, so I thought I'd open it up to a wider audience. I'm also hoping this work can be replicated into a drools-guice module, so we can start to have out of the box integration for the various containers out there, all working in a similar manner, possibly with standardised annotations.

You can also read about the JBoss MicroContainer integration work for Drools here:

Here is a copy of the message sent to the dev mailing list:
You can declare the transaction beans as follows:
<bean id="droolsTransactionManager"
<property name="workingMemory" ref="workingMemory"/>

<bean id="txProxyTemplate" abstract="true"
<property name="proxyTargetClass">
<property name="transactionManager" ref="droolsTransactionManager"/>
<property name="transactionAttributes">
<prop key="newStatefullSession*">PROPAGATION_REQUIRED</prop>

The last one is only a proxy for the transaction, to declare the pointcuts.
I think the classes for aspects in Ales implementation can be
implemented this way for spring, if not it will be needed to look at :
but I need time for that.

The DroolsTransactionManager is for standalone use.

It was added rule base configuration support for the bean factory of
Geoffrey as well to set the type.

Here are information about getting Resources like URL, input stream, file...


original post:

Sightings - Drools needs your help!

I want to revive the old Drools 2.x testimoney page, I'm hoping that two years on and with a vastly bigger community we can get a lot more references this time :)

There are two types of references. The official one which is handled via our marketting department and involves formal agreements between RedHat and the client - for obvious reasons these are time consuming to do and hard to get people to agree too. The other side is simply a page that has anything from a simple list of "users" and "integrators" listing company names, optional inclusions of logos and even small summary sentences or large case studies - nothing is too small or too big :)

So this is what I have so far:

We can't do this without you and it really is important for helping the adoption and growth of the software, lack of known users is often a blocker for large corporation adoption. So please if you can help, speak to your manager, and email me letting us know.

mproctor at redhat dot com

Monday, January 21, 2008

Cisco ANA uses Drools

GoogleAlerts just informed me that Cisco use Drools in their Active Network Abstract project. It's great to see Drools being used in big blue chip products in such a way that they haven't "masked" over that it's Drools underneath:
Cisco Active Network Abstraction
Cisco ANA Drools documentation

If anyone knows of any other products that use Drools, that mention it publicly, please let me know so I can reference them.


Wednesday, January 16, 2008

Debugging processes in JBoss Drools 5.0

It's been quiet over the Christmas period and we haven't shown you too much about the cool stuff we are doing. Never fret this blog will more than make up for it :) Kris Verlaenen has been working his magic again and we now have graphical debug tool for Drools processes, which will be part of the Drools 5.0 release at the end of Q1.

The processes

Our RuleBase contains 2 processes and some rules (used inside the ruleflow groups):

  • The main process contains some of the most common nodes: a start and end node (obviously), two ruleflow groups, an action (that simply prints a string to the default output), a milestone (a wait state that is trigger when a specific Event is inserted in the working memory) and a subprocess.

  • The SubProcess simply contains a milestone that also waits for (another) specific Event in the working memory.

  • There are only two rules (one for each ruleflow group) that simply print out either a hello world or goodbye world to default output.

I will simulate the execution of this process by starting the process, firing all rules (resulting in the executing of the hello rule), then adding the specific milestone events for both the milestones (in the main process and in the subprocess) and finally by firing all rules again (resulting in the executing of the goodbye rule). The console will look something like this:
Hello World
Executing action
Goodbye cruel world

Debugging the process

I added four breakpoints during the execution of the process (in the order in which they will be encountered):

  • At the start of the consequence of the hello rule

  • Before inserting the triggering event for the milestone in the main process

  • Before inserting the triggering event for the milestone in the subprocess

  • At the start of the consequence of the goodbye rule

When debugging the application, one can use the following debug views to track the execution of the process:

  • The working memory view, showing the contents (data) in the working memory.

  • The agenda view, showing all activations in the agenda.

  • The global data view, showing the globals.

  • The default Java Debug views, showing the current line and the value of the known variables, and this both for normal Java code as for rules.

  • NEW! The process instances view, showing all running processes (and their state).

  • The audit view, showing the audit log.

Figure: The process instances view, showing that there is currently one running process (instance), currently executing one node (instance), i.e. RuleSet node.

When double-clicking a process instance, the process instance viewer will graphically show the progress of the process instance. At each of the breakpoints, this will look like:

  • At the start of the consequence of the hello rule, only the hello ruleflow group is active, waiting on the execution of the hello rule:

  • Once that rule has been executed, the action, the milestone and the subprocess will be triggered. The action will be executed immediately, triggering the join (which will simply wait until all incomming connections have been triggered). The subprocess will wait at the milestone. So, before inserting the triggering event for the milestone in the main process, there now are two process instances, looking like this:

  • When triggering the event for the milestone in the main process, this will also trigger the join (which will simply wait until all incomming connections have been triggered). So at that point (before inserting the triggering event for the milestone in the subprocess), the processes will look like this:

  • When triggering the event for the milestone in the subprocess, this process instance will be completed and this will also trigger the join, which will then continue and trigger the goodbye ruleflow group, as all its incomming connections have been triggered. Firing all the rules will trigger the breakpoint in the goodbye rule. At that point, the situation looks like this:

After executing the goodbye rule, the main process will also be completed and the execution will have reached the end.

For those who want to look at the result in the audit view, this will look something like this [Note: the object insertion events might seem a little out of place, which is caused by the fact that they are only logged after (and never before) they are inserted, making it difficult to exactly pinpoint their location


Tuesday, January 15, 2008

Drools 4.0.4 Released

We just released Drools v4.0.4. This is a minor release with a few improvements on existing features and some bug fixes.

Release Notes - JBoss Drools - Version 4.0.4

We would like to really thanks all the contributors that helped on getting this release out. From those contributing patches and docs, to those testing and reporting bugs and providing feedback. The list is a bit long to post all names here and I may incur in a mistake forgetting someone, so our open public thank you to you all!

Follows the release notes.

Happy Drooling
Drools Team

Release Notes - JBoss Drools - Version 4.0.4


  • [JBRULES-1243] - Pattern matching does not allow spaces

  • [JBRULES-1274] - NPE when using reserved word "action" as a bound variable, or omitting rule title

  • [JBRULES-1284] - ClassCastException when using "<" constraint on field of type java.lang.Object containing data of type java.lang.Integer

  • [JBRULES-1310] - java.lang.NullPointerException at

  • [JBRULES-1311] - NPE when compiling rule consequences

  • [JBRULES-1313] - NullPointerException at on RHS for simplest of consequences

  • [JBRULES-1314] - Error parsing rule that is written in a single line

  • [JBRULES-1316] - Serialising Both the RuleBase and WorkingMemory throws null pointer

  • [JBRULES-1317] - Rule Execution Very Slow on Subsequent Session Using the Same Packages

  • [JBRULES-1321] - org.drools.compiler.DroolsParserException: Unknown error while parsing.
    org.drools.compiler.DroolsParserException: Unknown error while parsing.

  • [JBRULES-1325] - OutOfMemory with the use of WorkingMemoryFileLogger

  • [JBRULES-1336] - Typo in RuleBaseConfiguration(ClassLoader classLoder, Properties properties) -- the ClassLoader specified in the constructor args is not used

  • [JBRULES-1337] - 'or' with predicate/return val/inline eval with property issue

  • [JBRULES-1339] - Debugging: Breakpoints are only considered for code with variables

  • [JBRULES-1340] - JBRMS - Admin - Manage Archived Assets - Open item icon not opening item

  • [JBRULES-1348] - Incorrect hash code calculation for character attributes in alpha hashing optimization

  • [JBRULES-1354] - Duplicate parameter error while trying to use pattern bound variables or globals in accumulate function

  • [JBRULES-1364] - Drl parser 'or'

  • [JBRULES-1387] - Drools doesn't build with fresh maven2 installation and no repository

  • [JBRULES-1397] - org.mvel.CompileException: variable already defined within scope

  • [JBRULES-1410] - Rules with Collect / Accumulate CEs not working correctly when dinamically added to a rulebase

  • [JBRULES-1412] - ContextEntries should have cache nulled

  • [JBRULES-1413] - KnowledgeHelper should have cache reset before use.

  • [JBRULES-1416] - The use of HashKey is not thread safe in CompositeObjectSinkAdapter

Feature Request

  • [JBRULES-1308] - getFactHandle with equality-based assert behavior

  • [JBRULES-1349] - NotNode and Exists Improvements

  • [JBRULES-1395] - Add support to modify() block in java dialect consequences


  • [JBRULES-1323] - Add caching to the Objenesis instance and move instance to the RuleBase level


  • [JBRULES-1421] - Update mvel version to 1.2.21 and update mvel templates


Monday, January 14, 2008

Scalable Enterprise Drools

If you're 17 or 18, and about to finish 2nd level school, chances are that you want to apply to a 3rd Level College or University. Here in Ireland you get 100 points for each 'A' grade in your final school exams (Leaving certificate), 85 points for a 'B' grade and so on. You can then use these points to 'bid' for your preferred course, with Medical and Legal courses 'costing' the most. Think of it as EBay for education, managed by the CAO (Central Applications Office).

Of course, this being a Business Rules post, things are not quite as simple as that. Many courses such as Art and Drama require that you submit a portfolio of work. A lot of courses with strong people skills (e.g. Psychology) require an interview. And from this year, high demand medical courses have additional exams scores (testing for common sense and a personality!). These rules tend to be modified slightly from year to year. All these rules make the process more complex to administer, given that tens of thousands of people apply annually.

17 year olds being 17 year olds, all these applications hit the website in a 2-3 days 'spike' before the February 1st deadline. A 2nd spike hits the system in mid August when the actual exam results are published and college places are distributed.

Given that we're dealing with people's futures here how would you build the system (a) to process the rules clearly and correctly and (b) to guarantee that every application will processed , no matter how big the spike in workload is?. The current system has legacy issues, and has a history of falling over at critical moments (see stories here and here).

Problem A - how to run the course rules clearly and accurately - is a known issue, and can easily be solved using JBoss Drools.

Problem B - how to ensure the website / system is always available can also be solved quite easily : Use JMS to 'Queue' requests.

For example, at busy times in some call centres, instead waiting 'musak' you may get the message ' please leave your details and we'll call you back when you get the head of the queue. BT Ireland do this for their broadband support, and they call you back in the same order that you were waiting. This guarantees that even under large spikes all requests will be handled (eventually), but with no guarantee of when. This is better than the alternative of 'I'll hang around online until I get the complete reply'; if the web site falls over; no guarantee when or even if you'll get a response.

So, how do you put all of these together, perhaps with multiple versions of JBoss Drools (for extra scalability). By complete co-incidence (!) a whitepaper on how to build scalable websites using Drools and JMS messaging is here.


Monday, January 07, 2008

Rules as a strategic advantage

Well, thats a pretty boring business-ey title. But bear with me.

Recently I returned from a holiday to my home town of Sydney, Australia (it was a road trip, which I always like). The weather was soggier then I would have liked, had approximately 2 hours at the beach, in total, but I digress.

The part that is relevant to this blog? Well the highway (pacific highway) is increasingly turning into one big long freeway, and like all freeways, it has lots of oversize billboards.

One interesting billboard was for ANZ - a very large regional (and Australian) bank (I think ANZ standards for Australia and New Zealand - New Zealand being the wonderful place where they filmed lord of the rings). It was advertising the fact that they have a system called "Falcon" to protect against credit card fraud.

(I actually tried to find a YouTube video of the commercial showing them "unleash the falcon" - it is quite funny, but not to be found. Also, I think this is perhaps the first and only time I will use you tube in something actually work related !).

This "Falcon" is actually a product from Fair Isaac - a fraud detection system built with rules (ie a specific vertical application). That is about all I know about Falcon - but congratulations due to Fair Isaac for having a product so successful that their customers feel it is significant enough to have a major marketing campaign advertising the fact that they use this product to protect their customers.

I thought this was a great case of rule systems (or indeed any software at all) actually being a strategic advantage, not just a boring back office sub system.

And happy new year !

Wednesday, January 02, 2008

An Interview with Matthias Groch - Drools as a Research Platform

One of the goals of the Drools Team for the product (besides world domination ;) ) is to enable it as a research platform. We believe that there is still a lot to be researched and much knowledge to be created in the field, and providing a flexible and customizable engine to the community may both speed up the achievements of the researcher's goals as well as bring interesting new features for the product. Features that can also be further explored in new researches.

One of the researchers currently working with the Drools platform is Matthias Groch, a German student from Dresden University of Technology, under the supervision of Ph.D candidate Karen Walzer.

Matthias was kind to answer a few questions about him and the work he is doing at the moment and I think you all may find it an interesting read.


Matthias Groch

  • Matthias, can you tell us a bit about yourself?
I'm 27 years old and study Computer Science at Dresden University of Technology in Germany (since October 2001). At the moment I'm writing my diploma thesis (i.e. the final project) about extending the Rete algorithm temporally and thus to support CEP. Besides university, I gained some practical experience in software modelling and development by working as student assistant at the Chair of Modelling and Simulation (projects for the printing machine manufacturer KBA and Airbus) and in external internships (IBM Germany, Integranova Spain). In 2004, I attended a semester abroad at Swinburne University of Technology in Melbourne, Australia, and from September 2006 to March 2007 I worked as intern at Integranova in Madrid, Spain. That's my last years in short.

  • What is your Thesis about? Why did you chose this subject? In what manner do you think it helps innovate the field?
At present, complex event processing (CEP) resounds throughout the land. Particularly in the manufacturing domain - partly due to the introduction of RFID technology in the last years - CEP is on the rise. A real-world manufacturing scenario, where all kinds of events have to be processed, was the trigger for my thesis. Together with Karen, who is my supervisor, we want to extend the Rete algorithm (which originally was developed only for static facts) in such a way that processing of "event facts" becomes feasible. This includes application of logical operators and time windows, which originates from the field of data stream management systems. In a second step, we intend to examine whether favourable characteristics from the original algorithm such as almost linear scalability can be preserved.
Originally, the plan was to extend rule-based systems based on the Rete algorithm for CEP. In the course of that, the theoretical foundations were supposed to be applied to an open-source rule-based system. Finally, the enhanced system was ought to be compared with existing CEP engines such as Coral8, StreamBase or Esper. Since this is a pretty comprehensive task and many issues need to be taken into consideration, the scope has been reduced and my thesis will "only" deal with (sliding) windows over incoming events.
So in the end, we will hopefully have found to which degree Rete is suitable for CEP and what adaptations have to be made. Moreover, I will have contributed to a rule engine which processes rules AND is able to do CEP - which would be quite innovative already ;). A long-term goal would be to beat - or at least compete with - established CEP systems.

  • What got you interested in Drools?
To be honest, up to the point when I began working on my thesis (which was in August), I've never heard of rule-based systems, not to mention Drools. Then, after having become familiar with rule-based systems in general, the search for a mature rule engine so that we could put our ideas into practice. Soon it was clear that we would use Drools; besides being open-source, it had the best documentation available (including lots of examples) plus comprehensive first-hand help. First of all, there's the great mailing list with precise feedback (within hours) from the core developers and the community. Moreover; there's the Drools blog which keeps interested people up-to-date about recent developments as well as plans and visions for the future; I soon became a big fan of it. Last but not least I appreciate the possibility to directly get in touch with the core developers in the Drools chat and thus get immediate response to my questions. All these features convinced me to pick Drools and facilitated the access to rule-based systems in general and Drools in particular.

  • You already contributed to the Drools project. What have you done so far?
It's not that much so far. Nevertheless, I try to support Edson with his ambitious plans to integrate CEP in Drools. I illustrated that for correlating complex events, point-based semantics are not expressive enough; with them, only three relations (after, before, equals) between two events can be defined. Instead, interval-based semantics (introduced by Allen) allow for events with a duration greater than zero; the number of possible relations increases to thirteen. After Edson had introduced a pluggable operator interface to Drools, I defined and implemented all the thirteen relations. Moreover, in order to test the implemented operators and to add support events with non-zero duration, I added an overloaded insertion method for (event) facts; in addition to the usual insert(), it is now possible to specify a duration as parameter. At the moment I'm doing some research on how to evaluate sliding windows efficiently. As a result of that, a corresponding implementation for Drools will follow.

  • What are your plans for after your Graduation?
I intend to be done with my thesis by April. Then, I would like to start working as software engineer. I would like to continue working in the field of rule-based systems. Since the two semesters abroad in Australia and Spain, respectively, have been such great experiences, I fancy working in a foreign country. Anyway, as long as it is an interesting project, I'm open to anything.

Matthias, thank you for your time and our wishes of a resounding success in your thesis.

Drools Team