Dynamic window size behavior
You can automatically set the tumbling window's size at run-time by using a property value of the incoming record. The following use cases can help you understand the behavior of such windows by demonstrating use case scenarios when the Event Strategy rule is configured for dynamic window setting.
For demonstration purposes, the sample property whose value is used for dynamic window size setting is called pxResponseWaitingTime.
Dynamic window size resolution
The dynamic window size is derived from the first record that arrives at the window shape. The event strategy ignores the window size of any subsequent records that arrive at that window shape.
For example, in a data flow that contains an event strategy that is configured for dynamic window size, you insert the following records:
- Record 3, whose GroupID value is C and the pxResponseWaitingTime value is set to 2 seconds. The record is associated with the Rejected outcome. This record arrives first at the window shape and sets the window size to 2 seconds.
- Record 4, whose GroupID value is C and the pxResponseWaitingTime value is set to 4 seconds. The record is associated with the Accepted outcome. This record enters the window shape while the window set by record 3 is still pending.
Dynamic window start and expiration
For windows that are configured for dynamic size setting, a new window does not automatically start when the existing one expires.
For example, in a running data flow that contains an event strategy that is configured for dynamic window setting, you insert the following records in a specific sequence:
- You insert record 5, whose GroupID value is D and pxResponseWaitingTime is set to 1 second. The record is associated with the Accepted outcome.
- You wait until record 5 is emitted.
- You insert record 6, whose GroupID value is D and pxResponseWaitingTime is set to 3 seconds. The record is associated with the Rejected outcome.
Dynamic window size and data flow resumability
The dynamic window size state is not lost when the data flow that references the event strategy is paused.
For example, you insert a record with pxResponseWaitingTime value set to 5 seconds and that record is not associated with an outcome. Then, immediately after that record was inserted, you pause the data flow and then resume it after 10 seconds. In such case, the event strategy emits the record with no outcome immediately after you resumed the data flow.
Records with null or 0 dynamic window size
Records that do not have the time-out value specified, or that value is set to 0, are emitted immediately in event strategies that are configured for dynamic window size.
For example, you insert a record with pxResponseWaitingTime value set to 0 seconds and that record is associated with no outcome. When that record enters the window shape, it is immediately emitted. The same principle applies to records whose dynamic window setting property has null value.
Previous topic Adding filter conditions in event strategies Next topic Unit testing event strategies