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

Refactor Transformer templates to return the same strong-typed value.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.10.0.0
    • 0.10.0.0
    • streams

    Description

      Currently the Transformer interface's template is:

      R transform(K key, V value);
      

      While all its usage requires a key-value pair, and hence constructing the object as:

      new Transformer<K, V, KeyValue<K1, V1>>
      

      Since we expect Transformer to be only used in the Streams DSL, which is supposed to return another key-value pair streams, it's better to define its template just as

      public interface Transformer<K, V, K1, V1> {
      
          KeyValue<K1, V1> transform(K key, V value);
      }
      

      Also, we can allow punctuate() to also return a nullable KeyValue<K1, V1> pair, and let the implementation to forward to downstream processor only when the returned pair is not null.

      Attachments

        Activity

          People

            guozhang Guozhang Wang
            guozhang Guozhang Wang
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: