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.
The Join shape can work only in the context of windows. Each branch in an event strategy requires having at least one Window shape immediately preceding the Join shape. If the shape that precedes the Join shape is not a Window shape, the Join shape behaves as if the shape preceding it was a sliding Window whose size is 1. The Join shape behaves differently, depending on the type of Window shape that emits events directly to that Join shape.
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.
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.
Published May 18, 2016 — Updated September 6, 2017