LinkedIn
Copied!

Table of Contents

Dynamic window size behavior

Version:

Only available versions of this content are shown in the dropdown

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.
In this case, the event strategy emits record 4 for group C with the Accepted outcome 2 seconds after that record entered the window shape.

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:

  1. You insert record 5, whose GroupID value is D and pxResponseWaitingTime is set to 1 second. The record is associated with the Accepted outcome.
  2. You wait until record 5 is emitted.
  3. You insert record 6, whose GroupID value is D and pxResponseWaitingTime is set to 3 seconds. The record is associated with the Rejected outcome.
In such case, the event strategy emits record 5 with the associated outcome after 1 second. When the window for record 5 expires, no windows are active within the event strategy until record 6 arrives. When record 6 is inserted, a new window starts. The size of that window is equal to the value of the associated pxResponseWaitingTime property (3 seconds).

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.

The records are emitted immediately upon resuming a data flow only if the time-out has been reached and the window expired. Otherwise, the event strategy prevents records from being emitted.

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.

Did you find this content helpful?

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.