Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

(A) Change the semantics of punctuate() to be purely "system time driven", instead of "part time driven, and part data-driven". That is, the punctuate function triggering will no longer be dependent whether there are new data arriving, and hence not on the timestamps of the arriving data either. Instead it will be triggered only by system wall-clock time.

...

  1. If you need to add a pure time-driven computation logic, use punctuate().
  2. If you need to add a data-driven computation logic, you should always use process(), and in process() users can choose to trigger some specific logic only every some time units, but still when a new data has arrived and hence being processed

  3. . 

...

  1. . With this a punctuation with semantics close to current ones can be achieved but giving user control over the details, as follows:

    Code Block
        long lastPunctuationTime = 0;
    
        long interval = <some-number>; //millis
    
        @Override
        public void process(K key, V value){
    
            while (ctx.timestamp() >= lastPunctuationTime + interval){
    
                punctuate(ctx.timestamp()); //trigger punctuate or any other method at current record timestamp or lastPunctuationTime + interval, if the user prefers
    
                lastPunctuationTime += interval; // or do lastPunctuationTime = ctx.timestamp() if the user prefers
            }
    
            // do some other business logic here
    
        }

Drawbacks:

  • The above approach changes the semantics of the punctuate method and therefore is not backward-compatible.
  • It is not clear if doing data-driven periodic operations from the process() method without the intricate calculations of minimum timestamp per input partition is sufficient to cater for all use cases that may be attainable using present day stream-time based punctuate 

 

(B) An alternative could be to leave current semantics as the defaults for the punctuate method but allow a configuration switch between event and system time.

...