feat(messaging): consumidor idempotente (inbox) sobre RabbitMQ (fase 3a) - #3
Conversation
thomasmoreira
commented
Jun 8, 2026
Constrói o lado consumidor da mensageria — a fase 1 só tinha o produtor (outbox → dispatcher). Agora um serviço pode consumir eventos com exactly-once-effect (ADR-002). Messaging: - IEventSerializer.Deserialize (rehidrata o evento a partir do tipo da registration) - IInboxProcessor: roda o efeito uma única vez por message-id, na mesma transação que grava o inbox (efeito + dedup atômicos) - ConsumerRegistration/ConsumerRegistry: mapeia tipo do evento -> handler invoker - RabbitMqConsumerHost (BackgroundService): declara fila durável, faz bind nas routing keys registradas, consome com prefetch, ack após commit, nack+requeue em falha - DI: AddIntegrationEventConsumer<TEvent,THandler>() + AddRabbitMqConsumer(queue) Persistence: - EfInboxProcessor: check rápido no inbox + PK como garantia real (ADR-002) Testes: - InboxProcessorTests (Postgres): efeito roda 1x ao processar o mesmo id 2x (determinístico) - RabbitMqConsumerHostTests (Postgres + RabbitMQ): redelivery da MESMA mensagem dispara o efeito exatamente 1x — prova de F2 com infra real Build limpo (0/0); unit 4/4; integration 4 passam + 2 skipped (F1/F4).
|
Warning Review limit reached
More reviews will be available in 49 minutes and 17 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (13)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…3a) (#3) Constrói o lado consumidor da mensageria — a fase 1 só tinha o produtor (outbox → dispatcher). Agora um serviço pode consumir eventos com exactly-once-effect (ADR-002). Messaging: - IEventSerializer.Deserialize (rehidrata o evento a partir do tipo da registration) - IInboxProcessor: roda o efeito uma única vez por message-id, na mesma transação que grava o inbox (efeito + dedup atômicos) - ConsumerRegistration/ConsumerRegistry: mapeia tipo do evento -> handler invoker - RabbitMqConsumerHost (BackgroundService): declara fila durável, faz bind nas routing keys registradas, consome com prefetch, ack após commit, nack+requeue em falha - DI: AddIntegrationEventConsumer<TEvent,THandler>() + AddRabbitMqConsumer(queue) Persistence: - EfInboxProcessor: check rápido no inbox + PK como garantia real (ADR-002) Testes: - InboxProcessorTests (Postgres): efeito roda 1x ao processar o mesmo id 2x (determinístico) - RabbitMqConsumerHostTests (Postgres + RabbitMQ): redelivery da MESMA mensagem dispara o efeito exatamente 1x — prova de F2 com infra real Build limpo (0/0); unit 4/4; integration 4 passam + 2 skipped (F1/F4).