Package org.apache.kafka.streams.kstream
Class Grouped<K,V>
- java.lang.Object
-
- org.apache.kafka.streams.kstream.Grouped<K,V>
-
- Type Parameters:
K- the key typeV- the value type
public class Grouped<K,V> extends Object
The class that is used to capture the key and valueSerdes and set the part of name used for repartition topics when performingKStream.groupBy(KeyValueMapper, Grouped),KStream.groupByKey(Grouped), orKTable.groupBy(KeyValueMapper, Grouped)operations. Note that Kafka Streams does not always create repartition topics for grouping operations.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <K,V>
Grouped<K,V>as(String name)Create aGroupedinstance with the provided name used as part of the repartition topic if required.static <K,V>
Grouped<K,V>keySerde(Serde<K> keySerde)Create aGroupedinstance with the provided keySerde.static <K,V>
Grouped<K,V>valueSerde(Serde<V> valueSerde)Create aGroupedinstance with the provided valueSerde.static <K,V>
Grouped<K,V>with(String name, Serde<K> keySerde, Serde<V> valueSerde)Create aGroupedinstance with the provided name, keySerde, and valueSerde.static <K,V>
Grouped<K,V>with(Serde<K> keySerde, Serde<V> valueSerde)Create aGroupedinstance with the provided keySerde and valueSerde.Grouped<K,V>withKeySerde(Serde<K> keySerde)Perform the grouping operation using the provided keySerde for serializing the key.Grouped<K,V>withName(String name)Perform the grouping operation with the name for a repartition topic if required.Grouped<K,V>withValueSerde(Serde<V> valueSerde)Perform the grouping operation using the provided valueSerde for serializing the value.
-
-
-
Method Detail
-
as
public static <K,V> Grouped<K,V> as(String name)
Create aGroupedinstance with the provided name used as part of the repartition topic if required.- Parameters:
name- the name used for a repartition topic if required- Returns:
- a new
Groupedconfigured with the name - See Also:
KStream.groupByKey(Grouped),KStream.groupBy(KeyValueMapper, Grouped),KTable.groupBy(KeyValueMapper, Grouped)
-
keySerde
public static <K,V> Grouped<K,V> keySerde(Serde<K> keySerde)
Create aGroupedinstance with the provided keySerde. Ifnullthe default key serde from config will be used.- Parameters:
keySerde- the Serde used for serializing the key. Ifnullthe default key serde from config will be used- Returns:
- a new
Groupedconfigured with the keySerde - See Also:
KStream.groupByKey(Grouped),KStream.groupBy(KeyValueMapper, Grouped),KTable.groupBy(KeyValueMapper, Grouped)
-
valueSerde
public static <K,V> Grouped<K,V> valueSerde(Serde<V> valueSerde)
Create aGroupedinstance with the provided valueSerde. Ifnullthe default value serde from config will be used.- Parameters:
valueSerde- theSerdeused for serializing the value. Ifnullthe default value serde from config will be used- Returns:
- a new
Groupedconfigured with the valueSerde - See Also:
KStream.groupByKey(Grouped),KStream.groupBy(KeyValueMapper, Grouped),KTable.groupBy(KeyValueMapper, Grouped)
-
with
public static <K,V> Grouped<K,V> with(String name, Serde<K> keySerde, Serde<V> valueSerde)
Create aGroupedinstance with the provided name, keySerde, and valueSerde. If the keySerde and/or the valueSerde isnullthe default value for the respective serde from config will be used.- Parameters:
name- the name used as part of the repartition topic name if requiredkeySerde- theSerdeused for serializing the key. Ifnullthe default key serde from config will be usedvalueSerde- theSerdeused for serializing the value. Ifnullthe default value serde from config will be used- Returns:
- a new
Groupedconfigured with the name, keySerde, and valueSerde - See Also:
KStream.groupByKey(Grouped),KStream.groupBy(KeyValueMapper, Grouped),KTable.groupBy(KeyValueMapper, Grouped)
-
with
public static <K,V> Grouped<K,V> with(Serde<K> keySerde, Serde<V> valueSerde)
Create aGroupedinstance with the provided keySerde and valueSerde. If the keySerde and/or the valueSerde isnullthe default value for the respective serde from config will be used.- Parameters:
keySerde- theSerdeused for serializing the key. Ifnullthe default key serde from config will be usedvalueSerde- theSerdeused for serializing the value. Ifnullthe default value serde from config will be used- Returns:
- a new
Groupedconfigured with the keySerde, and valueSerde - See Also:
KStream.groupByKey(Grouped),KStream.groupBy(KeyValueMapper, Grouped),KTable.groupBy(KeyValueMapper, Grouped)
-
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
Groupedinstance 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.
-
-