60-300-024- use - the delay in calling delayed data -Flink Design and Implementation

1. The World

Here Insert Picture Description

2. Overview

There are electricity supplier in the course of this commodity purchase some scenarios: a user clicks on orders, this time in order to be paid the state, if after two hours still to be paid in the state that this order will be canceled, set to cancel the state; user revenue after the shipment of goods can be evaluated, if still not been evaluated within 24 hours, then the user will automatically set the score for commodities out of 5 stars .... And so, such a scenario can be called the delay processing scenario, when sending data out, not processed immediately, but after waiting for some time in the process, there are also a lot of programs for processing delay, such as:

  1. java in DelayQueue
    internal priority queue stored message body, the message body stored Dealy interfaces implemented, then one thread continued consumption data queue.
  2. In redis SortedSet
    means SortedSet Redis data structures, the use of time as the sort of way, using the external thread keeps polling the SortedSet.
  3. Scheduled scanning the database
    will trigger delay task information stored in the database, and then use the thread to query in rotation timed tasks that meet the requirements triggered.
    ......

In the stream processing often there will be some scenes timed trigger, such as timing alarm monitoring, and trigger delay time window is invoked by a trigger, then see how flink is to achieve any delay.

3.Flink delay in call

In flink real-time processing, the processing delay involved may be accomplished using KeyedProcessFunction, KeyedProcessFunction flink is to provide a user-oriented low level api, access status, the current or the current watermark ProcessingTime, more importantly, it is to provide

Guess you like

Origin blog.csdn.net/qq_21383435/article/details/105280175