messaging

pluginagentmarketplace's avatarfrom pluginagentmarketplace

Message queues and event-driven backend architecture. RabbitMQ, Kafka, pub/sub patterns, and async communication.

⭐1stars🔀0forks📁View on GitHub🕐Updated Jan 7, 2026

When & Why to Use This Skill

This Claude skill facilitates the design and implementation of scalable event-driven backend architectures. It provides expert guidance on integrating message brokers like RabbitMQ and Kafka, enabling developers to build decoupled, asynchronous systems. By covering essential patterns such as pub/sub, Dead Letter Queues (DLQ), and idempotent processing, it helps ensure high-throughput data handling and system reliability in microservices environments.

Use Cases

  • Case 1: Decoupling microservices by implementing asynchronous communication patterns to improve system responsiveness and fault tolerance.
  • Case 2: Configuring high-throughput event streaming and log aggregation pipelines using Apache Kafka for real-time data processing.
  • Case 3: Designing robust task queues with RabbitMQ, including the setup of durable exchanges and consumer acknowledgement strategies.
  • Case 4: Implementing advanced error-handling mechanisms like Dead Letter Queues (DLQ) and exponential backoff retries to prevent data loss during processing failures.
  • Case 5: Evaluating and selecting the optimal message broker (Redis, SQS, Kafka, or RabbitMQ) based on specific project requirements for ordering and throughput.
namemessaging
descriptionMessage queues and event-driven backend architecture. RabbitMQ, Kafka, pub/sub patterns, and async communication.
sasmp_version"2.0.0"
bonded_agent04-architecture-patterns
bond_typeSECONDARY_BOND
typestring
requiredfalse
minLength5
maxLength2000
enum[rabbitmq, kafka, redis, sqs]
max_attempts3
backoffexponential
initial_delay_ms1000
on_invoke"skill.messaging.invoked"
on_success"skill.messaging.completed"
on_error"skill.messaging.failed"
SUCCESS0
INVALID_INPUT1
CONNECTION_ERROR2

Messaging & Event-Driven Skill

Bonded to: architecture-patterns-agent (Secondary)


Quick Start

# Invoke messaging skill
"Set up RabbitMQ for my microservices"
"Implement event-driven order processing"
"Configure Kafka for high-throughput messaging"

Message Broker Comparison

Broker Best For Throughput Ordering
RabbitMQ Task queues, RPC Medium Per queue
Kafka Event streaming, logs Very high Per partition
Redis Pub/Sub Real-time, simple High None
SQS AWS serverless Medium FIFO optional

Examples

RabbitMQ Producer/Consumer

import pika
import json

# Producer
connection = pika.BlockingConnection(pika.ConnectionParameters('localhost'))
channel = connection.channel()
channel.queue_declare(queue='orders', durable=True)

def publish_order(order):
    channel.basic_publish(
        exchange='',
        routing_key='orders',
        body=json.dumps(order),
        properties=pika.BasicProperties(delivery_mode=2)  # persistent
    )

# Consumer
def process_order(ch, method, properties, body):
    order = json.loads(body)
    print(f"Processing order: {order['id']}")
    ch.basic_ack(delivery_tag=method.delivery_tag)

channel.basic_qos(prefetch_count=1)
channel.basic_consume(queue='orders', on_message_callback=process_order)
channel.start_consuming()

Kafka Event Streaming

from kafka import KafkaProducer, KafkaConsumer
import json

# Producer
producer = KafkaProducer(
    bootstrap_servers=['localhost:9092'],
    value_serializer=lambda v: json.dumps(v).encode('utf-8')
)

producer.send('user-events', {'type': 'USER_CREATED', 'user_id': '123'})

# Consumer
consumer = KafkaConsumer(
    'user-events',
    bootstrap_servers=['localhost:9092'],
    group_id='notification-service',
    auto_offset_reset='earliest',
    value_deserializer=lambda m: json.loads(m.decode('utf-8'))
)

for message in consumer:
    print(f"Event: {message.value}")

Patterns

Dead Letter Queue (DLQ)

def process_with_retry(message, max_retries=3):
    retry_count = message.headers.get('x-retry-count', 0)

    try:
        process(message)
    except Exception as e:
        if retry_count < max_retries:
            # Republish with incremented retry count
            republish_with_delay(message, retry_count + 1)
        else:
            # Send to DLQ
            publish_to_dlq(message, str(e))

Troubleshooting

Issue Cause Solution
Message loss No persistence Enable durable queues
Consumer lag Slow processing Scale consumers, batch processing
Duplicate processing No idempotency Implement idempotent consumers

Resources