Skip to content

feat(api): implement StreamEvents gRPC handler #12

@Depo-dev

Description

@Depo-dev

Summary

EventsServiceImpl::stream_events currently returns Status::unimplemented. Needs a live Redis Streams consumer that fans out matching events to connected gRPC clients.

Acceptance Criteria

  • Inject a redis::aio::ConnectionManager into EventsServiceImpl
  • On each client connection, spawn a tokio task that does XREAD BLOCK 0 STREAMS trident:events $ in a loop
  • Filter events by contract_id and/or topic_0 from StreamEventsRequest (if set)
  • Send matching events down a tokio::sync::mpsc channel; return ReceiverStream to tonic
  • Clean up the Redis reader task when the client disconnects (stream closed)
  • Integration test: publish a synthetic event to Redis, assert it arrives on a connected stream client

Files

crates/api/src/services/events.rs, crates/api/src/main.rs

Metadata

Metadata

Assignees

No one assigned

    Labels

    grpcgRPC API workphase-1MVP phase 1 scoperustRust crate work

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions