abrahamvilchesdelacruz/ididntcatchthat/api-events-infra

Claude Code and agent skill by abrahamvilchesdelacruz/ididntcatchthat

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

AmqpMessageBus, SubscribersBootstrapper, retry, DLQ, idempotencia en apps/api/. Trigger: Al implementar AmqpMessageBus, configurar SubscribersBootstrapper, o entender retry y DLQ.

Install

npx vskill@latest install abrahamvilchesdelacruz/ididntcatchthat/api-events-infra

SKILL.md

The same SKILL.md was published earlier as abrahamvilchesdelacruz/ididntcatchthat/api-events-infra.

When to Use

  • Al implementar o modificar AmqpMessageBus
  • Al registrar subscribers en módulos NestJS
  • Al diseñar la política de retry o idempotencia
Lee references/docs.md para skills relacionadas, ADRs y documentación externa.
Lee references/amqp-message-bus.md para la implementación completa de AmqpMessageBus, SubscribersBootstrapper y el registro en módulos.

Concepto

AmqpMessageBus implementa tres interfaces a la vez:

DomainEventPublisher (domain) → publish(events)
DomainEventConsumer (app) → consume(queue, eventName, exchange, DomainEventClass, handler)
OnModuleDestroy (NestJS) → onModuleDestroy() — cierra channel + connection al apagar

SubscribersBootstrapper llama a subscriber.init() en onModuleInit() — registra todos los consumers al arrancar.


Retry Policy

IntentoDelayMecanismo
11 sexpiration: "1000" en .retry → vuelve vía DLX
25 sexpiration: "5000" en .retry → vuelve vía DLX
310 sexpiration: "10000" en .retry → vuelve vía DLX
4—→ .dead_letter — intervención manual

El `expiration` es por mensaje, no por cola — permite backoff exponencial con una sola .retry queue.

Colas creadas automáticamente en setupQueues():

  • {queueName} — cola principal
  • {queueName}.retry — mensajes esperando reintento
  • {queueName}.dead_letter — mensajes agotados

Idempotencia

Opción A — Natural (por defecto)
typescript
async handle(event: DomainEvent): Promise<void> {
const existing = await this.repo.search(id);
if (existing) return; // ya procesado
await this.useCase.execute({ ... });
}
Opción B — Inbox table (operaciones irreversibles críticas)
typescript
async handle(event: DomainEvent): Promise<void> {
if (await this.inboxRepo.exists(event.eventId)) return;
await this.useCase.execute({ ... });
await this.inboxRepo.save(event.eventId, event.eventName());
}

Tabla: processed_events(event_id UUID PK, event_name, processed_at) — purgar > 30 días.


Reglas

  • AmqpMessageBus vive en shared/infrastructure/ — es transversal a todos los BC
  • AmqpMessageBus se registra una sola vez en SharedModule como singleton vía useExisting; los módulos BC no lo re-registran
  • SubscribersBootstrapper y el token SUBSCRIBERS se importan desde shared
  • OnModuleInit solo en SubscribersBootstrapper — nunca en subscribers ni use cases
  • SUBSCRIBERS se registra con useFactory que devuelve un array de subscribers — nunca useExisting + multi: true
  • El DLQ no se re-encola automáticamente — requiere fix manual + re-encolado explícito
  • prefetch(1) siempre — procesamiento secuencial por consumer
  • DomainEventClass es new (...args: unknown[]) => DomainEvent — no never, no any
  • El payload publicado usa el campo data para los atributos del evento, no attributes ni toPrimitives()
  • AmqpMessageBus tiene reconexión automática: al cerrar la conexión, espera RECONNECT_DELAY_MS y re-registra todos los consumers

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/abrahamvilchesdelacruz/ididntcatchthat/api-events-infra/badge)](https://verified-skill.com/skills/abrahamvilchesdelacruz/ididntcatchthat/api-events-infra)

Something wrong with this skill or its page? Tell us.