Consumed
provides the optional parameters that describe how to consume streams in the High-Level Stream Processing DSL:
-
Key Serde (Apache Kafka’s Serde for record keys)
-
Value Serde (Apache Kafka’s Serde for record values)
-
Offset reset policy (Topology.AutoOffsetReset)
Consumed
is used as an optional parameter in the following StreamsBuilder
operators:
Consumed<K, V> with(
final Serde<K> keySerde,
final Serde<V> valueSerde)
Consumed<K, V> with(final TimestampExtractor timestampExtractor)
Consumed<K, V> with(final Topology.AutoOffsetReset resetPolicy)
Consumed<K, V> with(
final Serde<K> keySerde,
final Serde<V> valueSerde,
final TimestampExtractor timestampExtractor,
final Topology.AutoOffsetReset resetPolicy)
A Consumed
instance can futher be configured using the "with" methods.
Method | Description |
---|---|
|
Consumed<K, V> withKeySerde(final Serde<K> keySerde) |
|
Consumed<K, V> withOffsetResetPolicy(
final Topology.AutoOffsetReset resetPolicy) |
|
Consumed<K, V> withTimestampExtractor(
final TimestampExtractor timestampExtractor) |
|
Consumed<K, V> withValueSerde(final Serde<V> valueSerde) |
Scala API for Kafka Streams makes the optional Consumed
metadata an implicit parameter in the StreamsBuilder
API.
Moreover, ImplicitConversions object defines consumedFromSerde implicit method that creates a Consumed
instance with the key and value Serde
objects available in implicit scope.
And the last but not least, Scala API for Kafka Streams defines Consumed object with `with`
factory methods that use implicit key and value Serde
objects.