Hi,

you should be able to retrieve your store with

https://github.com/apache/kafka/blob/trunk/streams/src/main/java/org/apache/kafka/streams/KafkaStreams.java#L1021

This would give you access to the store from inside your current application. In your Streams application your could then expose this Store with a say REST or any other RPC interface, to let applications from outside your JVM query it.

So i would say the blogpost still applies quite well.

Hope this helps

Best Jan


On 07.12.2017 04:59, Peter Figliozzi wrote:
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


Reply via email to