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
This class is used to provide the optional parameters when producing to new topics
using
KStream.to(String, Produced).-
Method Summary
Modifier and TypeMethodDescriptionstatic <K,V> Produced<K, V> Create an instance ofProducedwith provided processor name.booleaninthashCode()static <K,V> Produced<K, V> 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> 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.withKeySerde(Serde<K> keySerde) Produce records using the provided keySerde.withStreamPartitioner(StreamPartitioner<? super K, ? super V> partitioner) Produce records using the provided partitioner.withValueSerde(Serde<V> valueSerde) Produce records using the provided valueSerde.
-
Method Details
-
with
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
Producedinstance configured with keySerde and valueSerde - See Also:
-
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 andkeySerdeprovides aWindowedSerializerfor the keyWindowedStreamPartitionerwill be used—otherwiseDefaultStreamPartitionerwill be used- Returns:
- A new
Producedinstance configured with keySerde, valueSerde, and partitioner - See Also:
-
as
Create an instance ofProducedwith provided processor name.- Type Parameters:
K- key typeV- value type- Parameters:
processorName- the processor name to be used. Ifnulla default processor name will be generated- Returns:
- a new instance of
Produced
-
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
Producedinstance configured with keySerde - See Also:
-
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
Producedinstance configured with valueSerde - See Also:
-
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 aWindowedSerializerfor the keyWindowedStreamPartitionerwill be used—otherwiseDefaultStreamPartitionerwill be used- Returns:
- A new
Producedinstance configured with partitioner - See Also:
-
withStreamPartitioner
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 aWindowedSerializerfor the keyWindowedStreamPartitionerwill be used—otherwiseDefaultStreamPartitionerwill be used- Returns:
- this
-
withValueSerde
Produce records using the provided valueSerde.- Parameters:
valueSerde- Serde to use for serializing the value- Returns:
- this
-
withKeySerde
Produce records using the provided keySerde.- Parameters:
keySerde- Serde to use for serializing the key- Returns:
- this
-
equals
-
hashCode
public int hashCode() -
withName
-