Skip to content

[Feature Request]: Add the ability to cancel timers in methods annotated with @onWindowExpiration #33595

@slilichenko

Description

@slilichenko

What would you like to happen?

Stateful DoFns which use looping timers in ProcessTime domain need to clear the timers in order for the pipeline to drain properly when running using Dataflow runner. The only way now to detect the pipeline drain event is by defining a method annotated with @onWindowExpiration.

The documentation here states that this method can take the same parameters as the method annotated with @ontimer. But timer-related parameters are not allowed because there are not on the allow-list

The workaround is not complex - using a dedicated or some other state pointer, setting up the state to some value, clearing the state in the onWindowExpiration() and not setting the timer if the state is null, but it's not well known and adds unneeded complexity.

Issue Priority

Priority: 2 (default / most feature requests should be filed as P2)

Issue Components

  • Component: Python SDK
  • Component: Java SDK
  • Component: Go SDK
  • Component: Typescript SDK
  • Component: IO connector
  • Component: Beam YAML
  • Component: Beam examples
  • Component: Beam playground
  • Component: Beam katas
  • Component: Website
  • Component: Infrastructure
  • Component: Spark Runner
  • Component: Flink Runner
  • Component: Samza Runner
  • Component: Twister2 Runner
  • Component: Hazelcast Jet Runner
  • Component: Google Cloud Dataflow Runner

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions