Materialized — Metadata for State Store Materialized View

Materialized provides optional parameters that describe how to materialize a state store (as a KTable):

Materialized is used for the following:

Materialized is created using the factory methods.

Materialized<K, V, S> as(
  String storeName)
Materialized<K, V, KeyValueStore<Bytes, byte[]>> as(
  KeyValueBytesStoreSupplier supplier)
Materialized<K, V, SessionStore<Bytes, byte[]>> as(
  SessionBytesStoreSupplier supplier)
Materialized<K, V, WindowStore<Bytes, byte[]>> as(
  WindowBytesStoreSupplier supplier)
Materialized<K, V, S> with(
  Serde<K> keySerde,
  Serde<V> valueSerde)

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

Table 1. Materialized’s with Methods
Method Description


Materialized<K, V, S> withCachingDisabled()

Creates a Materialized with caching disabled


Materialized<K, V, S> withCachingEnabled()

Creates a Materialized with caching enabled


Materialized<K, V, S> withKeySerde(Serde<K> keySerde)

Creates a Materialized with the Serde for keys


Materialized<K, V, S> withLoggingDisabled()

Creates a Materialized with logging disabled


Materialized<K, V, S> withLoggingEnabled(Map<String, String> config)

Creates a Materialized with logging enabled


Materialized<K, V, S> withRetention(Duration retention)


Materialized<K, V, S> withValueSerde(Serde<V> valueSerde)

Creates a Materialized with the Serde for values

Scala API for Kafka Streams

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

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

Scala API for Kafka Streams also defines Materialized object with `with` and as factory methods that use implicit key and value Serde objects.

results matching ""

    No results matching ""