An event received by the subscriber of Event Analytics is inserted as a fact object (using the class HubEvent) into a stateful knowledge base. You can set up several independent stateful sessions in Event Analytics running in separate threads. Then, all rules are fired. Lastly, the inserted fact object is retracted. Session Start, Session Stop and Time (every minute) fact objects are inserted (and rules are fired) automatically.
In the rules, you can analyze the event data and post events using the publisher of Event Analytics, for example, post an event only when the old status is 10 and the new status is 20. You can also create new (meta-)events, for example, count number of new customer orders per customer and day. Stateful sessions' fact objects are persisted automatically. Hence, you can restart Event Analytics without losing counter values.
You can put custom jar files into the "lib" subfolder in the session directory. These are loaded automatically when starting the session.
Subscriptions for Event Analytics are defined as metadata attributes for rules in the following format:
When you (re-)load a session all subscriptions are merged and sent to the Event Hub.
rule "OOHEAD_20" @subscription(M3:OOHEAD:U) no-loop when event: HubEvent(publisher == "M3", documentName == "OOHEAD", operation == EventOperation.UPDATE, elementValues["ORSL"] == "20", elementOldValues["ORSL"] == "10") then event.postEvent("OOHEAD_20"); end
You can also declare your own fact types, for example, counters.