StateSerdes¶
StateSerdes<K, V>
is a factory for creating serializers and deserializers for state stores in Kafka Streams.
Demo¶
import org.apache.kafka.streams.state.StateSerdes
import java.lang.{Long => JLong}
val stateSerdes = StateSerdes.withBuiltinTypes[JLong, String]("topicName", classOf[JLong], classOf[String])
scala> :type stateSerdes
org.apache.kafka.streams.state.StateSerdes[Long,String]
Creating Instance¶
StateSerdes
takes the following to be created:
- Topic Name
- Key
Serde
- Value
Serde
StateSerdes
is created when:
CachingWindowStore
is requested toinitInternal
MeteredKeyValueStore
is requested toinitStoreSerde
MeteredSessionStore
is requested toinitStoreSerde
MeteredWindowStore
is requested toinitStoreSerde
- withBuiltinTypes
withBuiltinTypes¶
StateSerdes<K, V> withBuiltinTypes(
String topic,
Class<K> keyClass,
Class<V> valueClass)
withBuiltinTypes
creates a StateSerdes using Serdes.serdeFrom
utility with the given key and value classes.