# redis-mq **Repository Path**: bayavan-remote/redis-mq ## Basic Information - **Project Name**: redis-mq - **Description**: Redis based message queue wrapper crate - **Primary Language**: Rust - **License**: GPL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-08-12 - **Last Updated**: 2025-08-30 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Redis Stream Abstraction `Abdusami` `abdusami.dev@aliyun.com` A high-level Rust abstraction layer for Redis Streams that provides convenient and type-safe operations for message streaming patterns. ## Overview This library offers an elegant abstraction over Redis Streams, simplifying the implementation of producer-consumer patterns, message processing, and event-driven architectures. By leveraging Rust's strong type system and serde for serialization, it ensures both safety and convenience when working with Redis Streams. ## Features ### Stream Management - **Easy Stream Creation**: Quickly set up and manage multiple streams with intuitive APIs - **Type-Safe Operations**: All stream operations are validated at compile time - **Automatic Serialization**: Built-in support for serializing and deserializing messages ### Message Handling - **Structured Messages**: Define message formats using Rust enums and structs - **Automatic ACK**: Built-in message acknowledgment system for reliable processing - **Error Handling**: Comprehensive error types for all streaming operations ### Consumer Groups - **Group Management**: Simple API for creating and managing consumer groups - **Load Balancing**: Support for multiple consumers within groups - **Message Redelivery**: Handling for unacknowledged messages ### Producer Support - **Message Publishing**: Easy-to-use interface for sending messages to streams - **Serialization Integration**: Automatic conversion of Rust types to stream messages - **Batch Operations**: Support for publishing multiple messages efficiently ## Core Concepts ### Streams Logical channels for message flow, automatically managed with proper Redis key naming conventions. ### Messages Strongly-typed payloads that can be any serializable Rust type, with built-in support for common message patterns including success/error responses with payloads. ### Consumer Groups Managed groups that enable multiple consumers to process messages from the same stream while ensuring each message is processed only once. ### Serialization Seamless integration with serde for converting between Rust types and Redis Stream message formats, supporting JSON serialization out of the box. ## Usage Pattern 1. **Define your message types** using Rust enums or structs 2. **Create streams** with descriptive names and configurations 3. **Produce messages** by sending strongly-typed data 4. **Consume messages** with automatic deserialization into your types 5. **Handle processing** with built-in acknowledgment system ## Error Handling The library provides comprehensive error types for: - Stream operations failures - Message serialization/deserialization errors - Consumer group management issues - Network and Redis connection problems ## Reliability Features - **Message Persistence**: All messages are persisted in Redis - **Consumer Tracking**: Built-in consumer progress tracking - **Failure Recovery**: Automatic handling of consumer failures - **Connection Management**: Robust connection pooling and reconnection logic ## Ideal Use Cases - Event-driven architectures - Message queues and job processing - Real-time data processing pipelines - Microservices communication - Log aggregation and processing - IoT data streaming This abstraction layer makes Redis Streams accessible and type-safe for Rust developers, removing the complexity while maintaining the power and reliability of Redis Streams.