Split and Join logic in event strategies
The Join shape introduces a complex logic for processing events. That logic depends on the join condition and the configuration of shapes that precede the Join shape in an event strategy rule.
Sliding windows
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. At the same time, the Window shape forwards the latest event to the Join shape so that the states of both shapes match. Consider the following sample event strategy:
Sample event strategy with sliding windows
The strategy contains two sliding windows whose size is 2. The Join shape contains the following join condition: branch1.GroupId = branch2.GroupId. Both windows contain event A (GroupId is 1) and event B (GroupId is 1). When event C (whose GroupId property equals 1) enters both branches of the Event Strategy, the Window shapes are updated with the new event and event A is removed (the windows contain event B and event C). When Window shapes in both branches change their state, they automatically update the Join shape with the new event (both branches send event C to the Join shape and remove event A). As a result, the following event pairing occurs: BB, BC, CB, and CC.
Tumbling windows
The tumbling window processes events by moving the window over the data in chunks. After the window accumulates a specified number of events or the window time is over, it posts the collected events to the Join shape and moves to another chunk of data. Consider the following sample event strategy:
Sample event strategy with tumbling windows
The strategy contains two tumbling windows whose size is 2. The Join shape contains the following join condition: branch1.GroupId = branch2.GroupId. Both Window shapes contain event A (GroupId is 1) and event B (GroupId is 1) . When the Window shapes are updated with event C (GroupId is 1) , event A and event B are removed from both Window shapes. Now, an additional event D with GroupId that equals 1 enters the Window shapes. Because the size of both Window shapes is 2, their capacity is now full and they forward event C and event D to the Join shape. When event C and event D arrive at the Join shape from both branches, they update its state and remove event A and event B from it. As a result, the following event pairing occurs: CC, CD, DC, and DD.
For more information, see: Event Strategy rule type enhancements.
Previous topic Enhancements to data flows that contain event strategies Next topic Using event strategy in Pega Platform real-time event processing (7.3)