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

Provide low-level Processor API meta data in DSL layer

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • streams

    Description

      For Processor API, user can get meta data like record offset, timestamp etc via the provided Context object. It might be useful to allow uses to access this information in DSL layer, too.

      The idea would be, to do it "the Flink way", ie, by providing
      RichFunctions; mapValue() for example.

      Is takes a ValueMapper<V1, V2> that only has method

      V2 apply(V1 value);
      

      Thus, you cannot get any meta data within apply (it's completely "blind").

      We would add two more interfaces: RichFunction with a method
      open(Context context) and

      RichValueMapper<V1, V2> extends ValueMapper<V1, V2>, RichFunction
      

      This way, the user can chose to implement Rich- or Standard-function and
      we do not need to change existing APIs. Both can be handed into
      KStream.mapValues() for example. Internally, we check if a Rich
      function is provided, and if yes, hand in the Context object once, to
      make it available to the user who can now access it within apply() – or
      course, the user must set a member variable in open() to hold the
      reference to the Context object.

      KIP: https://cwiki.apache.org/confluence/display/KAFKA/KIP-159%3A+Introducing+Rich+functions+to+Streams

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mjsax Matthias J. Sax
              Votes:
              1 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated: