message-queues

GitHub

提供RabbitMQ、Kafka等消息队列的设计模式与最佳实践,涵盖工作队列、发布订阅、死信队列及幂等性处理,旨在构建可靠的消息驱动系统。

categories/backend/message-queues/SKILL.md cosmicstack-labs/mercury-agent-skills

Trigger Scenarios

设计消息驱动架构 集成RabbitMQ或Kafka 处理异步任务分发 实现事件流处理

Install

npx skills add cosmicstack-labs/mercury-agent-skills --skill message-queues -g -y
More Options

Non-standard path

npx skills add https://github.com/cosmicstack-labs/mercury-agent-skills/tree/main/categories/backend/message-queues -g -y

Use without installing

npx skills use cosmicstack-labs/mercury-agent-skills@message-queues

指定 Agent (Claude Code)

npx skills add cosmicstack-labs/mercury-agent-skills --skill message-queues -a claude-code -g -y

安装 repo 全部 skill

npx skills add cosmicstack-labs/mercury-agent-skills --all -g -y

预览 repo 内 skill

npx skills add cosmicstack-labs/mercury-agent-skills --list

SKILL.md

Frontmatter
{
    "name": "message-queues",
    "metadata": {
        "tags": [
            "message-queues",
            "kafka",
            "rabbitmq",
            "sqs",
            "event-streaming"
        ],
        "author": "cosmicstack-labs",
        "version": "1.0.0",
        "category": "backend"
    },
    "description": "RabbitMQ, Kafka, SQS, pub\/sub, competing consumers, dead letter queues, and event streaming"
}

Message Queues

Design reliable message-driven systems.

Queue Types

Queue Persistence Ordering Use Case
RabbitMQ Optional Per queue Task distribution, RPC
Apache Kafka Durable (disk) Per partition Event streaming, logs
AWS SQS Durable Best effort (std) / Strict (FIFO) Serverless decoupling
Redis Pub/Sub None Per channel Real-time notifications

RabbitMQ Patterns

Work Queues (Competing Consumers)

Producer → Queue → Consumer 1
                 → Consumer 2
                 → Consumer 3
  • Messages distributed round-robin
  • Ack on success, nack on failure (requeue or DLQ)
  • Prefetch count controls concurrency

Pub/Sub (Exchange → Binding → Queue)

  • Fanout: broadcast to all queues
  • Direct: route by routing key
  • Topic: route by pattern (user.*, user.created)
  • Headers: route by header values

Kafka Patterns

Topics & Partitions

  • Messages within a partition are ordered
  • Partitions enable parallelism
  • Consumer group = one instance per partition

Producer

await producer.send({
  topic: 'order-events',
  messages: [{ key: orderId, value: JSON.stringify(order) }],
});

Consumer

await consumer.run({
  eachMessage: async ({ topic, partition, message }) => {
    await processOrder(message.value);
  },
});

Dead Letter Queues

  • Messages that can't be processed go to DLQ
  • Analyze DLQ periodically for systemic issues
  • DLQ messages can be replayed after fix
  • Set max retry count before DLQ

Best Practices

  • Idempotent consumers (same message processed twice = safe)
  • Monitor queue depth, consumer lag, error rate
  • Set message TTL to prevent infinite backlog
  • Use structured message schemas (Avro, Protobuf)
  • Test with network failures and consumer crashes

Version History

  • 38e2523 Current 2026-07-05 19:36

Same Skill Collection

categories/ai-ml/agent-audit-logging/SKILL.md
categories/ai-ml/agent-handoff-protocols/SKILL.md
categories/ai-ml/agent-health-monitoring/SKILL.md
categories/ai-ml/agent-task-delegation/SKILL.md
categories/ai-ml/ai-agent-design/SKILL.md
categories/ai-ml/error-recovery-retry/SKILL.md
categories/ai-ml/memory-management/SKILL.md
categories/ai-ml/prompt-engineering/SKILL.md
categories/ai-ml/prompt-version-management/SKILL.md
categories/ai-ml/routerbase-model-gateway/SKILL.md
categories/ai-ml/token-budget-tracking/SKILL.md
categories/automation/daily-briefing/SKILL.md
categories/automation/screenshot/SKILL.md
categories/automation/shell-scripting/SKILL.md
categories/automation/twitter-account-manager/SKILL.md
categories/automation/workflow-automation/SKILL.md
categories/automation/x-twitter-automation/SKILL.md
categories/backend/api-design/SKILL.md
categories/backend/authentication-authorization/SKILL.md
categories/backend/caching-strategies/SKILL.md
categories/backend/database-design/SKILL.md
categories/backend/microservices/SKILL.md
categories/backend/nodejs-patterns/SKILL.md
categories/backend/python-patterns/SKILL.md
categories/backend/serverless-patterns/SKILL.md
categories/business/event-staffing-compliance/SKILL.md
categories/business/event-staffing-ordering/SKILL.md
categories/business/negotiation/SKILL.md
categories/business/startup-strategy/SKILL.md
categories/career/career-planning/SKILL.md
categories/career/interview-prep/SKILL.md
categories/career/linkedin-optimization/SKILL.md
categories/career/resume-writing/SKILL.md
categories/career/salary-negotiation/SKILL.md
categories/creative-personal-development/content-repurposer/SKILL.md
categories/creative-personal-development/daily-standup-journal/SKILL.md
categories/creative-personal-development/decision-matrix/SKILL.md
categories/creative-personal-development/idea-validator/SKILL.md
categories/creative-personal-development/meeting-note-summarizer/SKILL.md
categories/creative-personal-development/personal-branding-statement/SKILL.md
categories/creative-personal-development/storytelling-advisor/SKILL.md
categories/creative-personal-development/time-blocking-scheduler/SKILL.md
categories/data/data-pipeline/SKILL.md
categories/design/accessibility/SKILL.md
categories/design/ui-design-system/SKILL.md
categories/development/api-documentation/SKILL.md
categories/development/architecture-decision-records/SKILL.md
categories/development/clean-code/SKILL.md
categories/development/code-review/SKILL.md

Metadata

Files
0
Version
4c57cf2
Hash
165b8732
Indexed
2026-07-05 19:36

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-06 15:18
浙ICP备14020137号-1 $Гость$