Apache Flink - Send event if no data was received for x minutes
How can I implement an operator with Flink's DataStream API that sends an event when no data was received from a stream for a certain amount of time? Such an operator can be implemented using a ProcessFunction . DataStream<Long> input = env.fromElements(1L, 2L, 3L, 4L); input // use keyBy to have keyed state. // NullByteKeySelector will move all data to one task. You can also use other keys .keyBy(new NullByteKeySelector()) // use process function with 60 seconds timeout .process(new TimeOutFunction(60 * 1000)); The TimeOutFunction is defined as follows. In this example it uses processing time