Drools at JavaOne Brazil 2010
Hi all! During the last Java One in Brazil (Sao Paulo 7-9 December 2010) Esteban Aliverti and I (Salaboy) gave a talk about Drools to the Brazilian audience. In this post we want to share some details about this amazing experience.
Forty percent of the people in the room (120 approx.) knew about drools before the talk and twenty percent had already used it. A great section of the audience (about 60%) knew about Business Processes and Business Rules (not about Complex Event Processing or EDA).
Conceptual and Real Life Example
The presentation was divided into two main sections. First we explained the main concepts around the platform. We highlighted the importance of understanding the conceptual background of a Rule Engine, the BPM discipline plus the functionality provided by a BPMS and finally we showed the main characteristics of Complex Event Processing.
We explained the concepts using real life situations that showed the concepts in action and how developers can map them to applications to real problems.
You can download here the slides that we have used in the presentation and read the speaker notes where the slides are explained.
After explaining the conceptual background we showed how to model a real scenario that uses the main features of the platform. The source code of this application can be downloaded/cloned from the following github.com url:(relocated)
https://github.com/Salaboy/emergency-service-drools-appNote: please, feel free to send us comments, improvements, new features requests, etc. any feedback is highly appreciated.
We are refactoring this application to be able to include it as an official Drools example application. Right now the application shows how an Emergency Service company deals with emergencies that can happen somewhere in the city.
jBPM5/Drools Flow Business Process
We define a business process using jBPM5/Drools Flow that describes the steps to handle each emergency case.
Some Business Rules are defined for automatic decisions and suggestions. The ambulances are selected and equipped dynamically based on the available emergency information. The following rule shows the logic used to select and equip an ambulance for a Fire related emergency:
rule "Fire Emergency without more information" ruleflow-group "select_ambulance" salience 10 no-loop true when There is a FIRE Emergency going on then Select an available Ambulance for FIRE emergency Select an available BURNS specialist Prepare ambulance end
You can find the technical DRL and full DSLR file here.
Complex Event Processing
When the ambulance picks up the patient at the emergency location we want to monitor the patients vital signs at all times. In this application we use the Nintendo Wii Mote (Wii Remote Control) (link) to simulate the heart beats of the patient. Using Drools fusion, we analyze the stream of events generated by the Wii Mote’s accelerometer to detect anomalous situations and react to them. The following rules show the situations that we can detect right now. Of course that we can add more rules for more complex situations.
rule "Patient with no vital sign" when The average pulse is 235 in the last 4 seconds then Send 'No Signal Signs' Alert end rule "Patient heart attack" when The pulse is greater than 10/1 seconds then Send 'Heart Attack' Alert end
You can find the technical DRL file here.
One idea that is worth saving from the talk is the declarative approach to define business assets used in Drools and jBPM5, which allow us to maintain them separately from the rest of the application code. That allow the developer to validate and improve the business knowledge based on higher level feedback from managers and business analysts.