Skip to content

Support interactive-style local state lookups (Kafka Streams style) in Quix Streams #988

@lucasimi

Description

@lucasimi

In the Java kafka-streams library, interactive queries let developers access local state stores directly. This enables efficient, local key-value lookups (via ReadOnlyKeyValueStore.get(key)), perfect for low-latency dashboards, API endpoints, and RPC layers without needing to produce events or use streaming joins.

💡 Why this matters

These interactive queries allow state to be accumulated incrementally and queried on-demand, enabling distributed key-value stores across application instances, each owning a shard. Lookups differ from streaming joins because they're external, random-access reads—not part of the streaming topology.

In contrast, while Quix Streams supports stateful processing via RocksDB-backed state stores, there’s no public API to query those stores outside of the .apply() or .update() callbacks. That means you can't synchronously fetch state during a REST request—the REST handler can't access State.get(...) outside streaming callbacks.

❌ An alternative approach that does not work

When you try to simulate a lookup by sending a message to a Kafka topic and then waiting for the streaming pipeline to output the response, you end up building a request-response loop:

  1. A REST handler publishes a lookup request message.
  2. A streaming pipeline processes that message.
  3. The method .apply(..., stateful=True) generates a lookup-output record.
  4. The REST handler consumes the response.

This paradigm combines async streaming with synchronous REST, introducing latency, complexity, and timing issues. It's not equivalent to a Kafka Streams interactive query, where you can call store.get(key) directly within service code. If Quix Streams exposed an API like Kafka Streams' store(...), you could write:

store = app.store("my-kv-store")
value = store.get(key)

Have you ever considered to add a similar feature to Quix Stream?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions