You use the Event Strategy tab to design and configure your event strategy components. A new instance of the Event strategy rule contains two shapes: Real-time data and Emit. You can add shapes by clicking the add icon that is available when you focus on a shape. To edit a shape, open the properties dialog box of a shape (by double-clicking the shape or by right-clicking and selecting the Properties option). The properties dialog box contains elements that are specific to a given shape.
This is the starting shape of every event strategy. The Event key property identifies the class with your event strategy and it is used in the Window shape for grouping incoming events. You can use any property from the inheritance path of the event strategy as the event key or as a property that is available to the event strategy in the Available fields section.
In the Event time stamp section, select one of the following options:
System time - Use your system time when processing events.
Event time - Use this option when every event processed by your event strategy contains a property with time. Specify the property that contains the time stamp and the date format that it uses.
Note: The time stamps of consecutive events must be in ascending order.
In the Emit Properties dialog box, you can specify when your event strategy should emit events. The following options are available:
- As it happens - Emit the event as it happens.
- Only once - Emit the event as it happens, but only once during the specified time interval.
The Split shape allows for dividing the data stream into multiple paths to detect
meaningful patterns in customer behavior by separately analyzing various types of related
events. You can add this shape anywhere in the event strategy. The connector that radiates
from that shape always leads to the Emit shape. This means that the events from each path in
the event strategy are not combined before being emitted.
Split and Join
The Split and Join dual shape, like the Split shape, allows for dividing the data stream into multiple paths to detect meaningful patterns in customer behavior through a simultaneous analysis of multiple streams in a single event strategy rule instance. However, with the Join shape, you can combine the data before it is emitted from the event strategy. The joining of events from multiple streams in the event strategy is done on the basis of the specified join condition logic.
The Join shape operates only in the context of windows. If there is no Window shape before
the Join shape, that Join shape operates as if it was preceded by a sliding Window shape
that has the size of 1.
You can use this shape to filter out events of a specific data stream before they enter another shape. To filter out events, you can perform the following actions:
You can use windows to group relevant events from a data stream. You can define the window by the maximum number of events contained or by the maximum time interval to keep events.
In the Window section, you can select the following types of windows:
The Tumbling window processes events by moving the window over the data in chunks. After the window buffers a specified number of events or the window time has elapsed, it posts the collected events and moves to another chunk of data. No events are repeated in the next window.
You can manually specify the window size for all groups by selecting the User defined option for the window size. Alternatively, you can select the Defined by field to cause the event strategy to automatically define the window size for a group's new window from a specific property on the incoming event at run-time by using a specific property value of the incoming records. You can select any property from the event strategy inheritance path for dynamic window setting.
When the Defined by field option is selected and a new event for a group arrives at the window shape, a new window starts for that group if one does not already exist, with a size that is based on the value of the property specified in Defined by field parameter on the event. While active, the window collects events that apply to the corresponding record group. Upon the window time-out, the events are emitted and the window expires. When configured for dynamic window size, the window does not continue tumbling after expiring. For more information, see Dynamic window size behavior.
Note: When you run a batch or real-time data flow that contains an event strategy with Tumbling windows, in the Event strategy section of the Data Flow Work Item window, you can control whether a tumbling window emits remaining events after the data flow stops. If you disable this option, events that are not emitted from tumbling windows before the data flow stop are deleted.
The sliding window processes events by gradually moving the window over the data in single increments. As the new events come in, the oldest events are removed.
You can specify the number of events or the time interval in the Look for last field and drop-down list.
- The landmark window stores all events from the start of the data flow. Follow this window type with an Aggregate shape to calculate such values as median or standard deviation for specific property values of all events that the window captured.
The Window shape uses an event key as the default grouping. Separate windows are created for events with different event key values. If you want, you can also specify more properties and create separate windows for them.
This shape allows you to perform calculations on data from the data stream. Add aggregations and select calculation types to perform.
For the Lookup shape, you can specify the properties from an alternative data source and associate them with the data stream properties. You can add this shape in an event strategy anywhere between the Real-time data and Emit shapes.
When you add the Lookup shape to your event strategy and specify the settings for invoking
data from an alternative data set, a Static Data shape is automatically added to the data
flow that references the event strategy rule with a Lookup shape. In that Static Data shape,
you must point to the data set that contains the data that you want to use in the stream.
Additionally, you must map the properties from that data set to the data flow
- Event Strategy rule - Completing the Create, Save As, or Specialization form
- Adding aggregations in event strategies
- Adding local variables in event strategies
- Adding join conditions in event strategies
- Adding filter conditions in event strategies
- Dynamic window size behavior
- Unit testing event strategies
- Creating test cases for event strategies