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

Add KStream.peek(ForeachAction<K,V>)

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.10.1.1
    • 0.11.0.0
    • streams

    Description

      Java's Stream provides a handy peek method that observes elements in the stream without transforming or filtering them. While you can emulate this functionality with either a filter or map, peek provides potentially useful semantic information (doesn't modify the stream) and is much more concise.

      Example usage: using Dropwizard Metrics to provide event counters

      KStream<Integer, String> s = ...;
      s.map(this::mungeData)
       .peek((i, s) -> metrics.noteMungedEvent(i, s))
       .filter(this::hadProcessingError)
       .print();
      

      Attachments

        Issue Links

          Activity

            People

              stevenschlansker Steven Schlansker
              stevenschlansker Steven Schlansker
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: