Consumed — Metadata for Consuming Streams

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

Consumed is used as an optional parameter in the following StreamsBuilder operators:

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

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.

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

withKeySerde

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

withOffsetResetPolicy

Consumed<K, V> withOffsetResetPolicy(
  final Topology.AutoOffsetReset resetPolicy)

withTimestampExtractor

Consumed<K, V> withTimestampExtractor(
  final TimestampExtractor timestampExtractor)

withValueSerde

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

Scala API for Kafka Streams

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.

results matching ""

    No results matching ""