Reputation: 176
Can Flink set timer on the non-keyed stream?
ProcessAllWindowFunction
is a good option. But it cannot scale up the parallelism. It has to be 1.
I am looking for such non-keyed process function that can set a timer.
Upvotes: 2
Views: 859
Reputation: 113
you could keyBy(_ => None)
or keyBy() a constant and still use timers
Upvotes: 0
Reputation: 43514
Flink's timers are only available within keyed process functions.
The standard answer to this question is to go ahead and key the stream, adding a field holding a random number to use as the key (if there isn't already a suitable way to implement a key selector).
If you can't live with the expense of a network shuffle, for event-time timers you could implement a custom operator that implements your logic in its processWatermark
method.
And if you are looking for processing-time timers, you could roll your own.
Upvotes: 3