Information Technology Reference
In-Depth Information
Events and complex events
Before understanding CEP, we need to understand a series of other concepts tightly related
to it. The first and most important concept we need to define is an event. From a temporal
Business Rule perspective, we will define an event as any fact (an object in the rule
memory) that has temporal constraints of some sort: a moment in which it occurred, an op-
tional duration, and a life cycle.
Events can be anything that holds a relation to a specific point in time. A temperature
measuring could be used as a fact, but it can be treated as an event if we consider at what
time that measuring was taken. A phone call can have a price, a receiver, or a caller, but if
we add data of the exact moment it happened or how long the call lasted, it can be treated
as an event. Events usually represent things that already happened, so from a logical per-
spective, they should be immutable. The Drools framework doesn't enforce this to facilitate
all kinds of use cases to be represented, including the possibility of mutable events.
Now that we clearly understand what an event is, and know how to define it in a DRL, we
can work our way into defining a complex event . We will define a complex event as an ag-
gregation, composition, or abstraction of other events, which can be simple events or com-
plex events themselves, called component events. The concept implies that from some ba-
sic information about the world represented in events, we can define specific inferences
that will be treated themselves as events.
Let's review an example of a complex event to understand how complex events can be
composed of simple events. Imagine if we had a lot of seismic meters all over a city. Each
measurement will tell us whether we have an earthquake, with intensity and location. But
more importantly, it will have a timestamp to let us know at what moment in time the earth-
quake happened. Each seismic measure is our simple event.
Let's imagine that we detect a lot of very small earthquakes, not enough to disturb any
buildings, but we detect that they all happen in a straight line through the city—one after
the other, with maybe 2 or 3 seconds time difference. With temporal reasoning, we might
make an inference and say that probably a very large object is moving through the city.
This inferred event is our complex event, as explained in the following diagram:
Search WWH ::




Custom Search