kafka-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Figliozzi <pete.figlio...@gmail.com>
Subject Consuming a state store (KTable) basics - 1.0.0
Date Thu, 07 Dec 2017 03:59:17 GMT
I've written a Streams application which creates a KTable like this:

val myTable: KTable[String, GenericRecord] = myStream
    .groupByKey()
    .aggregate(myInitializer, myAdder, myStore)

where myStore was configured like this:

val myStore
    : Materialized[String, GenericRecord, KeyValueStore[Bytes,
Array[Byte]]] =
    Materialized
      .as("my-store")
      .withKeySerde(Serdes.String())
      .withValueSerde(genericValueSerde)

What I'd like to do now is query (read) this store from a separate
application.  How do I query it in 1.0.0?  With a KTable constructor, using
the store string as the topic, i.e.:

public <K,V> KTable<K,V> table(
java.lang.String topic,
Materialized<K,V,KeyValueStore<org.apache.kafka.common.utils.Bytes,byte[]>>
materialized)

Or some other way?

I saw this blog post
<https://blog.codecentric.de/en/2017/03/interactive-queries-in-apache-kafka-streams/>
but it appears to be only applicable to the older version of Kafka (please
correct me if I'm wrong).

Thanks,

Pete

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message