Class Grouped<K,V>

java.lang.Object
org.apache.kafka.streams.kstream.Grouped<K,V>
Type Parameters:
K - the key type
V - the value type

public class Grouped<K,V> extends Object
The class that is used to capture the key and value Serdes and set the part of name used for repartition topics when performing KStream.groupBy(KeyValueMapper, Grouped), KStream.groupByKey(Grouped), or KTable.groupBy(KeyValueMapper, Grouped) operations. Note that Kafka Streams does not always create repartition topics for grouping operations.
  • Method Details

    • as

      public static <K, V> Grouped<K,V> as(String name)
      Create a Grouped instance with the provided name used as part of the repartition topic if required.
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      name - the name used for a repartition topic if required
      Returns:
      a new Grouped configured with the name
      See Also:
    • keySerde

      public static <K, V> Grouped<K,V> keySerde(Serde<K> keySerde)
      Create a Grouped instance with the provided keySerde. If null the default key serde from config will be used.
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      keySerde - the Serde used for serializing the key. If null the default key serde from config will be used
      Returns:
      a new Grouped configured with the keySerde
      See Also:
    • valueSerde

      public static <K, V> Grouped<K,V> valueSerde(Serde<V> valueSerde)
      Create a Grouped instance with the provided valueSerde. If null the default value serde from config will be used.
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      valueSerde - the Serde used for serializing the value. If null the default value serde from config will be used
      Returns:
      a new Grouped configured with the valueSerde
      See Also:
    • with

      public static <K, V> Grouped<K,V> with(String name, Serde<K> keySerde, Serde<V> valueSerde)
      Create a Grouped instance with the provided name, keySerde, and valueSerde. If the keySerde and/or the valueSerde is null the default value for the respective serde from config will be used.
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      name - the name used as part of the repartition topic name if required
      keySerde - the Serde used for serializing the key. If null the default key serde from config will be used
      valueSerde - the Serde used for serializing the value. If null the default value serde from config will be used
      Returns:
      a new Grouped configured with the name, keySerde, and valueSerde
      See Also:
    • with

      public static <K, V> Grouped<K,V> with(Serde<K> keySerde, Serde<V> valueSerde)
      Create a Grouped instance with the provided keySerde and valueSerde. If the keySerde and/or the valueSerde is null the default value for the respective serde from config will be used.
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      keySerde - the Serde used for serializing the key. If null the default key serde from config will be used
      valueSerde - the Serde used for serializing the value. If null the default value serde from config will be used
      Returns:
      a new Grouped configured with the keySerde, and valueSerde
      See Also:
    • withName

      public Grouped<K,V> withName(String name)
      Perform the grouping operation with the name for a repartition topic if required. Note that Kafka Streams does not always create repartition topics for grouping operations.
      Parameters:
      name - the name used for the processor name and as part of the repartition topic name if required
      Returns:
      a new Grouped instance configured with the name
    • withKeySerde

      public Grouped<K,V> withKeySerde(Serde<K> keySerde)
      Perform the grouping operation using the provided keySerde for serializing the key.
      Parameters:
      keySerde - Serde to use for serializing the key. If null the default key serde from config will be used
      Returns:
      a new Grouped instance configured with the keySerde
    • withValueSerde

      public Grouped<K,V> withValueSerde(Serde<V> valueSerde)
      Perform the grouping operation using the provided valueSerde for serializing the value.
      Parameters:
      valueSerde - Serde to use for serializing the value. If null the default value serde from config will be used
      Returns:
      a new Grouped instance configured with the valueSerde