Package org.apache.kafka.streams.kstream
Class Repartitioned<K,V>
- java.lang.Object
-
- org.apache.kafka.streams.kstream.Repartitioned<K,V>
-
- Type Parameters:
K- key typeV- value type
public class Repartitioned<K,V> extends Object
This class is used to provide the optional parameters for internal repartition topics.
-
-
Field Summary
Fields Modifier and Type Field Description protected Serde<K>keySerdeprotected Stringnameprotected IntegernumberOfPartitionsprotected StreamPartitioner<K,V>partitionerprotected Serde<V>valueSerde
-
Constructor Summary
Constructors Modifier Constructor Description protectedRepartitioned(Repartitioned<K,V> repartitioned)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <K,V>
Repartitioned<K,V>as(String name)Create aRepartitionedinstance with the provided name used as part of the repartition topic.static <K,V>
Repartitioned<K,V>numberOfPartitions(int numberOfPartitions)Create aRepartitionedinstance with provided number of partitions for repartition topic.static <K,V>
Repartitioned<K,V>streamPartitioner(StreamPartitioner<K,V> partitioner)Create aRepartitionedinstance with provided partitioner.static <K,V>
Repartitioned<K,V>with(Serde<K> keySerde, Serde<V> valueSerde)Create aRepartitionedinstance with provided key serde and value serde.Repartitioned<K,V>withKeySerde(Serde<K> keySerde)Create a new instance ofRepartitionedwith the provided key serde.Repartitioned<K,V>withName(String name)Create a new instance ofRepartitionedwith the provided name used as part of repartition topic and processor name.Repartitioned<K,V>withNumberOfPartitions(int numberOfPartitions)Create a new instance ofRepartitionedwith the provided number of partitions for repartition topic.Repartitioned<K,V>withStreamPartitioner(StreamPartitioner<K,V> partitioner)Create a new instance ofRepartitionedwith the provided partitioner.Repartitioned<K,V>withValueSerde(Serde<V> valueSerde)Create a new instance ofRepartitionedwith the provided value serde.
-
-
-
Constructor Detail
-
Repartitioned
protected Repartitioned(Repartitioned<K,V> repartitioned)
-
-
Method Detail
-
as
public static <K,V> Repartitioned<K,V> as(String name)
Create aRepartitionedinstance with the provided name used as part of the repartition topic.- Type Parameters:
K- key typeV- value type- Parameters:
name- the name used as a processor named and part of the repartition topic name.- Returns:
- A new
Repartitionedinstance configured with processor name and repartition topic name - See Also:
KStream.repartition(Repartitioned)
-
with
public static <K,V> Repartitioned<K,V> with(Serde<K> keySerde, Serde<V> valueSerde)
Create aRepartitionedinstance with provided key serde and value serde.- Type Parameters:
K- key typeV- value type- Parameters:
keySerde- Serde to use for serializing the keyvalueSerde- Serde to use for serializing the value- Returns:
- A new
Repartitionedinstance configured with key serde and value serde - See Also:
KStream.repartition(Repartitioned)
-
streamPartitioner
public static <K,V> Repartitioned<K,V> streamPartitioner(StreamPartitioner<K,V> partitioner)
Create aRepartitionedinstance with provided partitioner.- Type Parameters:
K- key typeV- value type- Parameters:
partitioner- the function used to determine how records are distributed among partitions of the topic, if not specified and the key serde provides aWindowedSerializerfor the keyWindowedStreamPartitionerwill be used—otherwiseDefaultPartitionerwill be used- Returns:
- A new
Repartitionedinstance configured with partitioner - See Also:
KStream.repartition(Repartitioned)
-
numberOfPartitions
public static <K,V> Repartitioned<K,V> numberOfPartitions(int numberOfPartitions)
Create aRepartitionedinstance with provided number of partitions for repartition topic.- Type Parameters:
K- key typeV- value type- Parameters:
numberOfPartitions- number of partitions used when creating repartition topic- Returns:
- A new
Repartitionedinstance configured number of partitions - See Also:
KStream.repartition(Repartitioned)
-
withName
public Repartitioned<K,V> withName(String name)
Create a new instance ofRepartitionedwith the provided name used as part of repartition topic and processor name.- Parameters:
name- the name used for the processor name and as part of the repartition topic- Returns:
- a new
Repartitionedinstance configured with the name
-
withNumberOfPartitions
public Repartitioned<K,V> withNumberOfPartitions(int numberOfPartitions)
Create a new instance ofRepartitionedwith the provided number of partitions for repartition topic.- Parameters:
numberOfPartitions- the name used for the processor name and as part of the repartition topic name- Returns:
- a new
Repartitionedinstance configured with the number of partitions
-
withKeySerde
public Repartitioned<K,V> withKeySerde(Serde<K> keySerde)
Create a new instance ofRepartitionedwith the provided key serde.- Parameters:
keySerde- Serde to use for serializing the key- Returns:
- a new
Repartitionedinstance configured with the key serde
-
withValueSerde
public Repartitioned<K,V> withValueSerde(Serde<V> valueSerde)
Create a new instance ofRepartitionedwith the provided value serde.- Parameters:
valueSerde- Serde to use for serializing the value- Returns:
- a new
Repartitionedinstance configured with the value serde
-
withStreamPartitioner
public Repartitioned<K,V> withStreamPartitioner(StreamPartitioner<K,V> partitioner)
Create a new instance ofRepartitionedwith the provided partitioner.- Parameters:
partitioner- the function used to determine how records are distributed among partitions of the topic, if not specified and the key serde provides aWindowedSerializerfor the keyWindowedStreamPartitionerwill be used—otherwiseDefaultPartitionerwil be used- Returns:
- a new
Repartitionedinstance configured with provided partitioner
-
-