Overview

Chapter 9. Detecting event patterns

The chapter explains event pattern detection as a core capability of event processing, where meaningful combinations of events are identified rather than just individual occurrences. It introduces a Pattern detect agent that filters incoming events, selects the relevant ones as participant events, and then applies a pattern signature made up of a pattern type, relevant event types, optional parameters, and policies. The result of matching is a pattern matching set, which may be a single event, a subset of the participants, or even an empty set in cases such as absence patterns.

A major part of the chapter classifies common pattern types. Basic patterns include logical operators like all, any, and absence, threshold-based patterns such as count and value max/min/average, subset-selection patterns like first n, last n, and top-n variants, and modal patterns like always and sometimes. Dimensional patterns extend this idea into time, space, and combined spatiotemporal behavior, covering sequence, trends over time, distance-based checks, and movement patterns such as stationary, moving toward, or moving in a constant direction. Throughout these definitions, the text emphasizes how the meaning of a match depends on what portion of the participant set must satisfy the condition.

The chapter also shows that pattern matching is shaped by policies that resolve ambiguity and control runtime behavior. Evaluation policies decide whether matching happens immediately or only when a context closes, cardinality policies limit how many matching sets are produced, repeated type policies choose which instances are used when more than one event of a type is available, consumption policies determine whether matched events can be reused, and order policies define how temporal order is interpreted. The Fast Flower Delivery application is used repeatedly to illustrate these ideas in practice, showing how different patterns can support assignment, alerts, performance evaluation, and trend detection across multiple event-processing languages.

The logical structure of a Pattern detect agent, showing its three logical parts, with the “pattern signature” that controls the pattern detection process. The triangular objects represent event instances.
Illustration of the all pattern—an instance of every event type listed as a relevant event type must be present for the pattern to be matched. In this case there are three relevant event types (flight reservation, car reservation, and hotel reservation), and you can see that the participant event set includes an instance of each type.
A used book selling application that shows use of the Not-selected terminal. Book offer events are shown at the top, and book orders at the bottom. Two orders and one offer are left unpaired, and these will be routed through the agent’s Not-selected output terminal.
A count pattern where three instances of the same event type—customer complaint—match the pattern and suggest the likelihood of a frustrated customer
A trading example where the participant event set contains three events (two buy events and one sell event). The value max pattern will detect a match as the third event exceeds the $10M threshold.
This example illustrates modal patterns. The problems are assigned to a particular service representative, during the morning shift from 9:00 – 12:00.
A sequence pattern example—a patient who is readmitted to the hospital within 48 hours of having been discharged
A health monitor example used to illustrate various temporal trend patterns
An example showing the location of two delivery vans and three flower stores in the Fast Flower Delivery application. This demonstrates absolute distance patterns.
Examples that demonstrate three relative distance patterns. Going clockwise from the top right they are relative max distance, relative min distance, and relative average distance.
Spatiotemporal patterns where the events are reports of aircraft location
An example of the all pattern where there are multiple events of the same type
The effect of different evaluation and cardinality policies, when the repeated type policy is last. The events shown at the top of the figure give rise to the matching sets shown at the bottom.
An Apama example that shows the code for the Ranking increase and Improving note Pattern detect agents from the Fast Flower Delivery application
StreamBase implementation of the Automatic assignment pattern
IBM WebSphere Business Events example showing some patterns from the Fast Flower Delivery example

FAQ

What is an event pattern in Chapter 9?An event pattern is a template that specifies one or more combinations of events. A subset of events satisfies the pattern if it matches that template.
What does a Pattern detect EPA do?A Pattern detect event processing agent filters incoming events, selects participant events, and then performs matching to find subsets that satisfy a pattern. It can then pass the matching set to a derivation step.
What are participant events?Participant events are the event instances within the agent’s context partition that match event types listed in the relevant event types list.
What is the difference between a pattern matching set and the participant event set?The participant event set is the filtered collection of relevant events, while the pattern matching set is the subset of those participant events that satisfies the pattern.
What are the two main categories of event patterns described in the chapter?The chapter divides patterns into basic patterns and dimensional patterns. Basic patterns include logical, threshold, subset selection, and modal patterns, while dimensional patterns include temporal, spatial, and spatiotemporal patterns.
How does the all pattern work?The all pattern is satisfied when the participant event set contains at least one instance of each event type in the relevant event types list. The matching set contains one event for each required type.
How does the any pattern work?The any pattern is satisfied if the participant event set contains an instance of any one of the relevant event types. The matching set contains just the single event that caused the match.
What is the absence pattern used for?The absence pattern detects when no participant events of the specified type occur. It is often used for timeout detection, such as alerting when a confirmation event does not arrive in time.
What is the purpose of pattern policies?Pattern policies disambiguate and fine-tune how pattern matching works. They control things like when matching happens, how many matching sets are produced, how repeated event types are handled, whether events are consumed or reused, and how temporal order is defined.
What is the difference between immediate and deferred evaluation policies?Immediate evaluation tests the pattern each time a new event arrives, while deferred evaluation tests the pattern only when the temporal context window closes.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


Close
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Event Processing in Action Event Processing in Action ebook for free