Produced — Metadata for Producing Streams

Produced provides the optional parameters that describe how to produce streams in the High-Level Stream Processing DSL:

Produced is used as an optional parameter in the following KStream operators:

A Produced instance is created using one of the available factory methods.

Produced<K, V> keySerde(
  Serde<K> keySerde)
Produced<K, V> streamPartitioner(
  StreamPartitioner<? super K, ? super V> partitioner)
Produced<K, V> valueSerde(
  Serde<V> valueSerde)
Produced<K, V> with(
  Serde<K> keySerde,
  Serde<V> valueSerde)
Produced<K, V> with(
  Serde<K> keySerde,
  Serde<V> valueSerde,
  StreamPartitioner<? super K, ? super V> partitioner)

A Produced instance can futher be configured using the "with" methods.

Table 1. Produced’s "with" Methods
Method Description

withKeySerde

Produced<K, V> withKeySerde(final Serde<K> keySerde)

withStreamPartitioner

Produced<K, V> withStreamPartitioner(
  final StreamPartitioner<? super K, ? super V> partitioner)

withValueSerde

Produced<K, V> withValueSerde(final Serde<V> valueSerde)

Scala API for Kafka Streams

Scala API for Kafka Streams makes the optional Produced metadata an implicit parameter in the KStream API.

Moreover, ImplicitConversions object defines producedFromSerde implicit method that creates a Produced instance with the key and value Serde objects available in implicit scope.

And the last but not least, Scala API for Kafka Streams defines Produced object with `with` factory methods that use implicit key and value Serde objects.

results matching ""

    No results matching ""