thanks for your reply.
It seems like 1.2 will be a very awesome release.
I’m looking forward to it :)
Von: Aljoscha Krettek [mailto:firstname.lastname@example.org]
Gesendet: Donnerstag, 1. Dezember 2016 12:41
Betreff: Re: Time To Live-Setting for State/StateDescriptor
we're aware of the issue (https://issues.apache.org/jira/browse/FLINK-3946) but unfortunately it's not implemented yet. I recently added ProcessFunction which is somewhat similar to a flatmap but also allows setting timers. This can be used to set a TTL timer and then call clear() on the state when the timer fires. This will be release in Flink 1.2.
On Wed, 30 Nov 2016 at 17:13 Julian Bauß <email@example.com> wrote:
does Flink offer any automated TTL-functionality for operator state?
My current solution for deleting state after some time is using a SessionWindow which triggers after a timeout and sends messages to stateful operators which then call the clear() method on their state.
This is my solution in pseudocode:
sessionEndNotifications = dataStream.window(EventTimeSessionWindows.withGap(Time.hours(1)).apply(new StateInvalidatorFunction).keyBy(...);
The StatefulFlatMapFunction calls state.clear() in its flatMap2 function when it receives a sessionEndNotification. The flatMap1 function contains the actual business logic which is being calculated per event.
I feel like I'm doing this in a roundabout way. Are there better ways of doing this?