- Home
- Skills
- Data & Databases
- Redis Pubsub Event Architect
Works with the AI Agents you already use
Redis Pubsub Event Architect
Architect and implement reliable Redis Streams with consumer groups, persistent messaging, and failure recovery.
$15
Redis Pubsub Event Architect
Example session with this skill installed
Design a reliable message queue for a microservice using Redis Streams in Python. I need consumer groups and a way to handle messages that were never acknowledged.
- Read your context and instructions
- Compiled the redis pubsub event
I have designed a Redis Streams architecture for your microservice. This implementation uses consumer groups for horizontal scaling and handles message recovery via the Pending Entries List (PEL).
Redis Streams Reliable Consumer Logic
import redis
import time
r = redis.Redis(host='localhost', port=6379, decode_responses=True)
STREAM_NAME = 'orders_stream'
GROUP_NAME = 'order_processor_group'
CONSUMER_NAME = 'consumer_1'
# 1. Initialize Stream and Group
try:
r.xgroup_create(STREAM_NAME, GROUP_NAME, id='0', mkstream=True)
except redis.exceptions.ResponseError:
pass # Group already exists
def process_messages():
while True:
# 2. Check for pending (unacknowledged) messages first
pending = r.xreadgroup(GROUP_NAME, CONSUMER_NAME, {STREAM_NAME: '0'}, count=10)
# 3. Read new messages if no pending tasks
if not pending:
messages = r.xreadgroup(GROUP_NAME, CONSUMER_NAME, {STREAM_NAME: '>'}, count=10, block=2000)
else:
messages = pending
for stream, msgs in messages:
for message_id, data in msgs:
try:
print(f"Processing {message_id}: {data}")
# Simulate work
time.sleep(0.1)
# 4. Acknowledge successful processing
r.xack(STREAM_NAME, GROUP_NAME, message_id)
except Exception as e:
print(f"Failed to process {message_id}: {e}")
if __name__ == "__main__":
# Producer Example: r.xadd(STREAM_NAME, {'order_id': '123'}, maxlen=100000)
process_messages()
Next steps
- Implement a monitoring script using
XPENDINGto identify messages stuck in the PEL for longer than your TTL. - Update your producer code to use the
MAXLENparameter to prevent the Redis instance from running out of memory. - Configure your deployment to spin up multiple consumer instances using unique
CONSUMER_NAMEidentifiers.
Connects securely to your tools. The creator never sees your data.
About this skill
Managing high-throughput messaging in Redis often leads to data loss or unacknowledged messages when using simple pub/sub. This skill provides the architectural logic to move beyond fire-and-forget patterns into persistent, reliable Redis Streams.
What it does
- Architectural Selection determines whether Pub/Sub, Redis Streams, or key-space notifications fit the specific persistence requirements.
- Producer Implementation generates code for
XADDoperations with boundedMAXLENto prevent memory exhaustion. - Consumer Group Configuration builds
XGROUP CREATEandXREADGROUPlogic for distributed message processing. - Reliability Engineering handles message acknowledgement via
XACKand manages retries using the Pending Entries List (XPENDING,XCLAIM).
How it works
- Analyze Requirements to choose between ephemeral fire-and-forget or persistent stream-based messaging.
- Generate Producer Logic for bounded streams to ensure predictable memory usage.
- Establish Consumer Groups to enable horizontal scaling and message replayability.
- Implement Acknowledgment Flows to recover from consumer failures and process pending entries.
Frameworks & tools
This skill outputs production-ready logic for Node.js and Python environments. It utilizes the Redis Streams API, including consumer group management and manual acknowledgment commands.
Why this beats prompting it yourself
Generic prompts often ignore the complexities of the Pending Entries List (PEL) or fail to bound stream length, leading to memory leaks. This skill enforces strict reliability patterns and memory safety guardrails by default.
Use cases
- Microservices Orchestration where reliable event delivery between services is required.
- Real-time Analytics requiring replayable message logs for late-joining consumers.
- Job Queuing Systems that need distributed processing with explicit task completion signals.
Known limitations
Does not support global system package installation or administrative Redis commands. Strictly restricted to Node.js and Python code outputs within the active workspace.
Requires Node.js or Python environment. No support for global system packages or administrative Redis configuration. Workspace restricted to local directory.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 2 days ago
Requires
Permissions
Target Use Cases: - Build a persistent task queue using Redis Streams. - Implement Redis consumer group with message acknowledgement. - Configure Redis Streams XREADGROUP with error claiming.