K - type of the keyOM - type of the outputpublic interface ScheduledFunction<K,OM>
 Example of a FlatMapFunction with ScheduledFunction:
 
    public class ExampleScheduledFn implements FlatMapFunction<String, String>, ScheduledFunction<String, String> {
      // for recurring callbacks, keep track of the scheduler from "schedule"
      private Scheduler scheduler;
      public void schedule(Scheduler scheduler) {
        // save the scheduler for recurring callbacks
        this.scheduler = scheduler;
        long time = System.currentTimeMillis() + 5000; // fire after 5 sec
        scheduler.schedule("do-delayed-logic", time);
      }
      public Collection<String> apply(String s) {
        ...
      }
      public Collection<String> onCallback(String key, long timestamp) {
        // do some logic for key "do-delayed-logic"
        ...
        // for recurring callbacks, call the saved scheduler again
        this.scheduler.schedule("example-process", System.currentTimeMillis() + 5000);
      }
    }
 | Modifier and Type | Method and Description | 
|---|---|
| java.util.Collection<OM> | onCallback(K key,
          long timestamp)Returns the output from the scheduling logic corresponding to the key that was triggered. | 
| void | schedule(Scheduler<K> scheduler)Allows scheduling the initial callback(s) and saving the  schedulerfor later use for recurring callbacks. | 
void schedule(Scheduler<K> scheduler)
scheduler for later use for recurring callbacks.scheduler - used to specify the schedule time(s) and key(s)java.util.Collection<OM> onCallback(K key, long timestamp)
key - key corresponding to the callback that got invokedtimestamp - schedule time that was set for the callback for the key, in milliseconds since epochCollection of output elements