Drools Fusion (Complex event processing) is the Drools for complex event handling modules, and it functions like Esper, both of which can provide event processing based on time span and sliding window, the biggest difference between the two is probably 1. Drools Open source, does not support distribution, syntax DRL, Esper has Enterprise Edition, support distribution, syntax class SQL
Look at the official documents.
http://docs.jboss.org/drools/release/5.6.0.Final/drools-fusion-docs/html_single/
Wrote a few examples
Https://github.com/zhwbqd/droolsCEP
Here's a look at some of the key concepts in drools fusion
1. The difference between event and fact
- An event is typically an immutable object
- Event is strongly correlated with time
- Event has a manageable life cycle (typically matching rules in a limited amount of time, facilitating engine management to automatically manage the event, destroying the mismatched event, and freeing up related resources)
- Each event has its own TS, which can be used to slide the time window, for example: statistic the average of the past 60min
2. Drools support two semantic event, point in time and interval (difference is whether the @duration annotation is 0) 3. Notes:1. @role default fact, CEP time @role (event) identifies fact as an event
2. @timestamp, each event has a related timestamp, which is obtained from the system by default (that is, the time to insert the session), or it can be assigned externally3. @duration, the duration of each event is 0 in Point-in-time event, and the default value is 0, externally assignable
4. @expire, only valid in stream mode, expiration time of event, @expire 300s expiration @expire (1d3h45m20s29ms) 1 days 3 hours 45 minutes 20 seconds 29 milliseconds expired
4. Sessionclock A total of 4, mainly used in two kinds, realtime and pseudo5. After, before, During, Meet and other keywords are used to compare the occurrence of two events in chronological orderlike the meaning of the Before keyword.
This
6. Sliding Window can only run in stream mode, Slidingwindow will perform the operation immediately, and will not wait until the event satisfies the requirement to calculate, the event is not in the Sliding Window matches will not be destroyed, there may be other event dependent on it, it will expire within its own expire time
Drools Fusion (CEP) Example and key concepts