feat: add initial

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2026-02-26 21:52:50 +01:00
commit 3162971c89
48 changed files with 3041 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
# SQ-014: SDK Producer
**Status:** `[ ] TODO`
**Blocked by:** SQ-010
**Priority:** Medium
## Description
Ergonomic Rust producer client in sq-sdk. Handles connection management, batching, and retry logic.
## Files to Create/Modify
- `crates/sq-sdk/src/lib.rs` - re-exports
- `crates/sq-sdk/src/connection.rs` - gRPC channel management
- `crates/sq-sdk/src/producer.rs` - Producer with batching, linger timer, retry
- `crates/sq-sdk/src/error.rs` - SqError type
## Producer API
```rust
pub struct ProducerConfig {
pub server_addresses: Vec<String>,
pub default_ack_mode: AckMode,
pub max_retries: u32,
pub retry_backoff_ms: u64,
}
pub struct Producer { /* ... */ }
impl Producer {
pub async fn connect(config: ProducerConfig) -> Result<Self, SqError>;
pub async fn send(&self, topic: &str, key: Option<&[u8]>, value: &[u8]) -> Result<SendResult, SqError>;
pub async fn send_batch(&self, messages: Vec<ProducerMessage>) -> Result<Vec<SendResult>, SqError>;
}
```
## Acceptance Criteria
- [ ] Producer connects to running server, sends message, gets offset back
- [ ] Send batch: all messages get sequential offsets
- [ ] Connection failure: returns appropriate error
- [ ] Multiple server addresses: round-robin or failover