Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-6092

Time passed in punctuate call is currentTime, not punctuate schedule time.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Not A Problem
    • 0.11.0.0
    • None
    • streams
    • None

    Description

      The java doc specifies that for a Transformer, calling context.schedule calls punctuate every 1000ms. This is not entirely accurate, as if no data is received for a while, punctuate won't be called.

           *             void init(ProcessorContext context) {
           *                 this.context = context;
           *                 this.state = context.getStateStore("myTransformState");
           *                 context.schedule(1000); // call #punctuate() each 1000ms
           *             }
      

      When you receive new data say after 20 seconds, punctuate will play catch up and will be called 20 times at reception of the new data.

      the signature of punctuate is

      *             KeyValue punctuate(long timestamp) {
           *                 // can access this.state
           *                 // can emit as many new KeyValue pairs as required via this.context#forward()
           *                 return null; // don't return result -- can also be "new KeyValue()"
           *             }
      

      but the timestamp being passed is currentTimestamp at the time of the call to punctuate, not at the time the punctuate was scheduled. It is very confusing and I think the timestamp should represent the one at which the punctuate should have been scheduled. Getting the current timestamp is not adding much information as it can easily obtained using System.currentTimeMillis();

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              stephane.maarek@gmail.com Stephane Maarek
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: