30 lines
1.1 KiB
Markdown
30 lines
1.1 KiB
Markdown
# SQ-011: Subscribe Endpoint (Single Node)
|
|
|
|
**Status:** `[x] DONE`
|
|
**Blocked by:** SQ-010
|
|
**Priority:** High
|
|
|
|
## Description
|
|
|
|
Implement the Subscribe gRPC RPC with server-streaming. Server pushes messages to the client as they become available.
|
|
|
|
## Files to Create/Modify
|
|
|
|
- `crates/sq-server/src/grpc/data_plane.rs` - DataPlaneService Subscribe impl
|
|
|
|
## Behavior
|
|
|
|
1. Client sends SubscribeRequest with topic, partition, optional start_offset
|
|
2. Server reads from StorageEngine starting at the given offset
|
|
3. Server streams batches of ConsumedMessage to the client
|
|
4. When caught up, server polls for new messages at a configurable interval (e.g. 100ms)
|
|
5. Stream continues until client disconnects or cancellation
|
|
|
|
## Acceptance Criteria
|
|
|
|
- [ ] Publish 10 messages, then subscribe from offset 0, receive all 10
|
|
- [ ] Subscribe from offset 5, receive messages 5-9 only
|
|
- [ ] Subscribe to empty topic from offset 0, then publish, receive new messages
|
|
- [ ] Client disconnect: server-side stream cleans up without error
|
|
- [ ] Subscribe to nonexistent topic: returns NotFound gRPC status
|