feat(api): implement StreamEvents gRPC with Redis Streams fan-out#28
Open
Depo-dev wants to merge 1 commit into
Open
feat(api): implement StreamEvents gRPC with Redis Streams fan-out#28Depo-dev wants to merge 1 commit into
Depo-dev wants to merge 1 commit into
Conversation
…-out On each client connection, spawns a tokio task that runs XREAD BLOCK (5s timeout) in a loop on the trident:events stream. Filters entries by contract_id and optional topic_0, builds proto Event messages from the flat Redis hash, and sends them down a bounded mpsc channel returned as ReceiverStream. Task exits cleanly when the client disconnects (tx closed). Adds ConnectionManager for safe multi-clone Redis access. Integration test publishes a synthetic Redis entry and asserts it arrives on the connected stream (gated on TEST_REDIS_URL).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements
stream_eventsserver-streaming RPC. Each connection spawns a dedicated tokio reader task that consumes thetrident:eventsRedis stream and pushes matching events down a bounded channel to the gRPC client.Implementation
XREAD BLOCK 5000 COUNT 100loop with$start cursor (new messages only)contract_id(required) andtopic_0(optional)redis::aio::ConnectionManagerfor safe clone-and-share across tasksREDIS_URLenv var inmain.rsTest
stream_events_delivers_published_event— publishes a synthetic Redis entry 100ms after subscription, asserts event arrives within 8s. Gated onTEST_REDIS_URL.Closes #12