How to query all unique keys in a WindowStore over a time range?

525 views
Skip to first unread message

Roland Hochmuth

unread,
Jan 1, 2017, 3:38:13 PM1/1/17
to Confluent Platform
Hi, A ReadOnlyKeyValueStore, https://github.com/apache/kafka/blob/0.10.1/streams/src/main/java/org/apache/kafka/streams/state/ReadOnlyKeyValueStore.java, allows you to get all keys in the store and then iterate over them. However, the ReadOnlyWindowStore, https://github.com/apache/kafka/blob/0.10.1/streams/src/main/java/org/apache/kafka/streams/state/ReadOnlyWindowStore.java, does not appear to support querying all the keys over a time range. The key is required in the "fetch" method. 

My use case is that in different windows the number of keys might vary. For example, in a monitoring application in time window 1, there might be one node, and then in time window 2, there could be two nodes, and the keys would be used to track metrics for each node. The nodes are elastic and will dynamically be added or removed over time. What I was hoping to do is similar to the KeyValueStore, just get all the keys, which would correspond to nodes, for a window. I understand that a single key in a WindowStore could have multiple windows. In my case I would like to get all the unique keys for a single window or alternatively the list of unique keys for each window that is between the specified time range in the fetch method.

Currently, it looks like I might have to track the keys/nodes separately. I was just wondering if there was a simpler way for my use case or if I was missing something or misinterpreting/misusing the API.

Regards --Roland

Matthias J. Sax

unread,
Jan 2, 2017, 1:43:34 PM1/2/17
to confluent...@googlegroups.com
Unfortunately, there is no easy way for this right now. Tracking the
keys manually is a good workaround for now.

We do have a JIRA for this feature already:
https://issues.apache.org/jira/browse/KAFKA-4499


-Matthias
> --
> You received this message because you are subscribed to the Google
> Groups "Confluent Platform" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to confluent-platf...@googlegroups.com
> <mailto:confluent-platf...@googlegroups.com>.
> To post to this group, send email to confluent...@googlegroups.com
> <mailto:confluent...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/confluent-platform/d3fe36ae-4b98-4122-97c3-0e5ddea2ccab%40googlegroups.com
> <https://groups.google.com/d/msgid/confluent-platform/d3fe36ae-4b98-4122-97c3-0e5ddea2ccab%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

signature.asc
Reply all
Reply to author
Forward
0 new messages