Package org.apache.kafka.streams.kstream
Class Produced<K,V>
- java.lang.Object
-
- org.apache.kafka.streams.kstream.Produced<K,V>
-
- Type Parameters:
K
- key typeV
- value type
public class Produced<K,V> extends Object
This class is used to provide the optional parameters when producing to new topics usingKStream.through(String, Produced)
orKStream.to(String, Produced)
.
-
-
Field Summary
Fields Modifier and Type Field Description protected Serde<K>
keySerde
protected StreamPartitioner<? super K,? super V>
partitioner
protected String
processorName
protected Serde<V>
valueSerde
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <K,V>
Produced<K,V>as(String processorName)
Create an instance ofProduced
with provided processor name.boolean
equals(Object o)
int
hashCode()
static <K,V>
Produced<K,V>keySerde(Serde<K> keySerde)
Create a Produced instance with provided keySerde.static <K,V>
Produced<K,V>streamPartitioner(StreamPartitioner<? super K,? super V> partitioner)
Create a Produced instance with provided partitioner.static <K,V>
Produced<K,V>valueSerde(Serde<V> valueSerde)
Create a Produced instance with provided valueSerde.static <K,V>
Produced<K,V>with(Serde<K> keySerde, Serde<V> valueSerde)
Create a Produced instance with provided keySerde and valueSerde.static <K,V>
Produced<K,V>with(Serde<K> keySerde, Serde<V> valueSerde, StreamPartitioner<? super K,? super V> partitioner)
Create a Produced instance with provided keySerde, valueSerde, and partitioner.Produced<K,V>
withKeySerde(Serde<K> keySerde)
Produce records using the provided keySerde.Produced<K,V>
withName(String name)
Produced<K,V>
withStreamPartitioner(StreamPartitioner<? super K,? super V> partitioner)
Produce records using the provided partitioner.Produced<K,V>
withValueSerde(Serde<V> valueSerde)
Produce records using the provided valueSerde.
-
-
-
Method Detail
-
with
public static <K,V> Produced<K,V> with(Serde<K> keySerde, Serde<V> valueSerde)
Create a Produced instance with provided keySerde and valueSerde.- 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
Produced
instance configured with keySerde and valueSerde - See Also:
KStream.through(String, Produced)
,KStream.to(String, Produced)
-
with
public static <K,V> Produced<K,V> with(Serde<K> keySerde, Serde<V> valueSerde, StreamPartitioner<? super K,? super V> partitioner)
Create a Produced instance with provided keySerde, valueSerde, and partitioner.- Type Parameters:
K
- key typeV
- value type- Parameters:
keySerde
- Serde to use for serializing the keyvalueSerde
- Serde to use for serializing the valuepartitioner
- the function used to determine how records are distributed among partitions of the topic, if not specified andkeySerde
provides aWindowedSerializer
for the keyWindowedStreamPartitioner
will be used—otherwiseDefaultPartitioner
will be used- Returns:
- A new
Produced
instance configured with keySerde, valueSerde, and partitioner - See Also:
KStream.through(String, Produced)
,KStream.to(String, Produced)
-
as
public static <K,V> Produced<K,V> as(String processorName)
Create an instance ofProduced
with provided processor name.- Type Parameters:
K
- key typeV
- value type- Parameters:
processorName
- the processor name to be used. Ifnull
a default processor name will be generated- Returns:
- a new instance of
Produced
-
keySerde
public static <K,V> Produced<K,V> keySerde(Serde<K> keySerde)
Create a Produced instance with provided keySerde.- Type Parameters:
K
- key typeV
- value type- Parameters:
keySerde
- Serde to use for serializing the key- Returns:
- A new
Produced
instance configured with keySerde - See Also:
KStream.through(String, Produced)
,KStream.to(String, Produced)
-
valueSerde
public static <K,V> Produced<K,V> valueSerde(Serde<V> valueSerde)
Create a Produced instance with provided valueSerde.- Type Parameters:
K
- key typeV
- value type- Parameters:
valueSerde
- Serde to use for serializing the key- Returns:
- A new
Produced
instance configured with valueSerde - See Also:
KStream.through(String, Produced)
,KStream.to(String, Produced)
-
streamPartitioner
public static <K,V> Produced<K,V> streamPartitioner(StreamPartitioner<? super K,? super V> partitioner)
Create a Produced instance 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 aWindowedSerializer
for the keyWindowedStreamPartitioner
will be used—otherwiseDefaultPartitioner
will be used- Returns:
- A new
Produced
instance configured with partitioner - See Also:
KStream.through(String, Produced)
,KStream.to(String, Produced)
-
withStreamPartitioner
public Produced<K,V> withStreamPartitioner(StreamPartitioner<? super K,? super V> partitioner)
Produce records using 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 aWindowedSerializer
for the keyWindowedStreamPartitioner
will be used—otherwiseDefaultPartitioner
wil be used- Returns:
- this
-
withValueSerde
public Produced<K,V> withValueSerde(Serde<V> valueSerde)
Produce records using the provided valueSerde.- Parameters:
valueSerde
- Serde to use for serializing the value- Returns:
- this
-
withKeySerde
public Produced<K,V> withKeySerde(Serde<K> keySerde)
Produce records using the provided keySerde.- Parameters:
keySerde
- Serde to use for serializing the key- Returns:
- this
-
-