Drools is a business rule management system with a forward-chaining and backward-chaining inference based rules engine, allowing fast and reliable evaluation of business rules and complex event processing. Read the documentation: http://docs.jboss.org/drools/release/7.0.0.Final/drools-docs/html_single/
This code simulates a long-lived session where rules are applied on a sequence of output from a sensor.