Reacting to real-time events
Configure your application to detect meaningful patterns in the real-time flow of events and to react to them in a timely manner. By detecting event patterns through Event Strategy rules, you can identify the most critical opportunities and risks to help you determine the Next Best Action for your customers.
You can configure Data Flows to listen to real-time data streams (as large as tens of thousands of events per second) and pick up events of interest by using Event Strategy rules. Example events are Call Detail Records, prepaid balance recharges, credit cards transactions, and so on. Event Strategies are especially useful if the decision to create a high-level event depends on multiple sub-events in a data stream. For example, you can detect whether a customer made a specific number of credit card transactions during a particular time window (for example, a week).
If such a high-level event is detected, you can run a decision strategy to determine the next best action for that customer or write an event to a customer data store, such as Customer Movie.
Event Strategy shapes
Event Strategy logic is defined by a sequence of shapes that contain various processing instructions. You can use the following shape types in an Event Strategy:
Real-time data, Filter, and Window shapes in an Event Strategy
- Real-time data – Configure a read-only list of properties from an event stream. You can also select the source of the time property of the incoming events (event time or system time). Pega recommends that you use a dataset that can stream data in real-time, for example, Kafka or Kinesis.
- Filter – Filter out events based on specific property values or static data that is associated with a particular event.
- Window – Define time-based or count-based windows (tumbling or sliding). You can partition data according to attributes other than the event key.
Split and join, Aggregate, and Emit shapes in an Event Strategy
- Split and join – Split event streams into parallel sub-streams. You can apply different processing logic to each sub-stream and then join their output. For example, you can use this shape to determine whether the average number of text messages is lower today than during the last week.
- Aggregate – Compute aggregates such as SUM, LAST, COUNT, FIRST, and AVERAGE of a window.
- Emit – Defines the release policy for high-level events. You can emit an event immediately, on schedule, or when nothing happens.
Example Event Strategy
The example Event Strategy below performs the following actions:
- Listens to a real-time dataset (1).
- Filters out dropped customer calls (2).
- Stores the terminated calls for one day (3).
- Counts the number of terminated calls within the time window of one day (4).
- Creates an event if three calls are terminated within the time window of one day (5).
- Emits the event (6).
Example Event Strategy that detects dropped calls
The Event Strategy is called from the Data Flow rule that is shown below. If the Event Strategy emits an event, this Data Flow rule runs a Strategy to determine the next best action.
Data Flow that references an Event Strategy
Previous topic Techniques for integrating Cassandra with your application in Pega 7.2.2 Next topic Enhancements to data flows that contain event strategies