2. How to process the context events in real-time
To perform some processing on available context information you need a Complex Event Processing
The CEP allows you to detect patterns above contexts (triggering some action or raising some alarm)
The CEP receives contexts information as input events and generates observations (or situations) as
output events
3. Applications role
Applications connected to the CEP GE (external applications or some other GE like Context Broker GE)
can play two different role:
the role of Event Producer
the role of Event Consumer
Note: A given application can play both roles
4. Event Producer
Event Producer sources can be:
an external applications reporting events
a sensor reporting a measurement
Event Producers can be provide events in two modes:
Push mode - the Event Producers push events into the CEP by means of invoking a REST API
Pull mode - the Event Producer exports a REST API that the CEP can invoke to retrieve events
5. Event Consumer
Event Consumers are the destination point of events. For example:
Dashboard: a type of event consumer that displays alarms defined when certain conditions hold on events related
to some entities user community or produced by a number of devices
Handling process: a type of event consumer that consumes meaningful events (such as opportunities or threats)
and performs a concrete action
The Context Broker GE which can connect as an event consumer to the CEP and forward the events it consumes
to all interested applications based on a subscription model
6. Pattern
The CEP allows you to define patterns over selected events occurring in event processing contexts (such
as a time window or segmentation) with optional additional conditions
Those patterns can be defined using Web based authoring tool (without to write any code)
7. Event Processing Agent (EPA) - Pattern
Patterns supported are:
Basic type, meaning a basic event
a lamp battery charge is below 15 percent
Aggregate type, compute some aggregation functions on a set of incoming events
the percentage of failed measurements is higher than 10 percent in the last 5 minutes
Absent type, meaning no event holding some condition arrived within the time window for the pattern to match
no sensor events arrived in the last 10 minutes
Sequence type, meaning events need to occur in a specified order for the pattern to be detected
detect if the sensor status was “fixed” and later was “failed” within 24 hours
All type, meaning that all the events specified should arrive for the pattern to match
alert if the total reservations number arriving from 4 branches is higher than some threshold
8. From Event-Condition-Action to Pattern-Condition-Action
In certain scenarios, single events are insignificant, a CEP engine can detect combinations of events,
and generate derived events situations, which are meaningful
Use CEP when there is a need to detect patterns over incoming events
Other tools can be used when there is a need to respond to single events with some condition (e.g.,
Context Broker GE)
9. Event Processing Context definition
Every EPA (event processing agent - pattern) is associated with an event processing context
Event processing context can be a:
temporal processing context (time window)
segmentation processing context
composite context (group of several contexts) +
Event processing context groups event instances can be processed in a related way
10. Working with the CEP
The FI-WARE CEP instance: IBM Proactive Technology Online - PROTON
11. Proton (CEP GE Instance) – Build Time Web User Interface
Definition type (or build block) of CEP:
Event types - events that are expected to be received as input or to be sent as output
EPAs - responsible to detect patterns: Basic, Aggregate, Absent, Sequence, All
Processing Contexts - Temporal, Segmentation, Composite
Consumers - the event consumers: File, REST, JMS, Custom
Producers - the event source: File, REST, JMS, Custom
12. Build Time Web User Interface
The Authoring tool allows you to define a CEP application, validate it, and export the application definition
13. Create definitions
Definitions can be generated by the user through a WEB User Interface
Definitions can be generated by external systems
In JSON format
16. Proton (CEP GE Instance) – Rest Input Adapter
Rest Input Adapter Client
Has a Producer definition in the Web UI
Activates a REST service as a client
Access the REST API declared by the event producer and pull events using the GET method
Support format:
Tag delimited
JSON
Name=ShipPosition;ShipID=RTX33;Long=46;Lat=55;Speed=4.0;Time=1333033200;
{
"Name":"TrafficReport",
"volume":"1000“
}
17. Proton (CEP GE Instance) – Rest Output Adapter
Rest Output Adapter Client
Has a Consumer definition in the Web UI
Activates a REST service as a client
Access the REST API declared by the event consumer and push events to the consumer using the POST method
Support format:
Tag delimited
JSON
Name=TrafficReport;Certainty=0.0;Cost=0.0;EventSource=;OccurrenceTime=null;Annotation=;Duration=0.0;volume=1000;
EventId=40f68052‐3c7c‐4245‐ae5a‐6e20def2e618;ExpirationTime=null;Chronon=null;DetectionTime=1349181899221;
{"Cost":"0.0","Certainty":"0.0","Name":"TrafficReport","EventSource":"","Duration":"0.0","Annotation":"",
"volume":"1000","EventId":"e206b5e8‐9f3a‐4711‐9f46‐d0e9431fe215","DetectionTime":"1350311378034"}
18. How to administrate the CEP – REST ADMIN APIs
Managing the Definitions Repository
GET all the existing definitions in the repository
GET specific definition in JSON format
POST a new definition
PUT update for a definition
DELETE definition
Administrating runtime Instances
GET instance status
PUT instance status
Reading the State of the CEP engine:
The instance’s definition URI
The instance’s state (stopped or started)
19. How to send input events to the CEP
Example to send event in the JSON format (in push mode)
POST <cep_host>:<port>/{instance_name}/rest/events
(Example: POST: http://130.206.81.23:8080/ProtonOnWebServer/rest/events)
Headers: {'Content‐Type’: 'application/json’; 'X‐Auth‐Token' : <Oauth2.0 TOKEN>}
{
"Name":"TrafficReport",
"volume":"1000"
}