Materialized
provides optional parameters that describe how to materialize a state store (as a KTable):
-
Name of the state store
Materialized
is used for the following:
-
In High-Level Stream Processing DSL to create KTables and global KTables
-
KTable API
-
For
count
,reduce
andaggregate
operators in KGroupedStream, KGroupedTable, SessionWindowedKStream, TimeWindowedKStream
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.
Method | Description |
---|---|
|
Materialized<K, V, S> withCachingDisabled() Creates a |
|
Materialized<K, V, S> withCachingEnabled() Creates a |
|
Materialized<K, V, S> withKeySerde(Serde<K> keySerde) Creates a |
|
Materialized<K, V, S> withLoggingDisabled() Creates a |
|
Materialized<K, V, S> withLoggingEnabled(Map<String, String> config) Creates a |
|
Materialized<K, V, S> withRetention(Duration retention) |
|
Materialized<K, V, S> withValueSerde(Serde<V> valueSerde) Creates a |
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.