Skip to content

Adds Inbox support to Mocha#9332

Merged
PascalSenn merged 10 commits intomainfrom
pse/adds-inbox
Mar 9, 2026
Merged

Adds Inbox support to Mocha#9332
PascalSenn merged 10 commits intomainfrom
pse/adds-inbox

Conversation

@PascalSenn
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings March 8, 2026 22:30
@github-actions github-actions Bot added the 📚 documentation This issue is about working on our documentation. label Mar 8, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds inbox (idempotent consumer) support to the Mocha messaging framework. The inbox complements the existing transactional outbox by deduplicating incoming messages on the receiving side, enabling effectively exactly-once message processing. The implementation includes a new Mocha.Inbox library, Postgres-backed inbox persistence via EF Core, a background cleanup worker, consumer middleware for deduplication, comprehensive tests, and documentation updates.

Changes:

  • New Mocha.Inbox project with IMessageInbox interface, ConsumeInboxMiddleware, InboxCleanupProcessor, MessageBusInboxWorker, and supporting types for inbox feature control and configuration.
  • Postgres inbox persistence (PostgresMessageInbox, EF Core entity configuration, SQL queries, migrations) integrated into all three demo services (Catalog, Billing, Shipping) and the OutboxInbox example.
  • Documentation updates across reliability, middleware, routing, transport, and index pages to describe the inbox feature and its interaction with the outbox for exactly-once delivery guarantees.

Reviewed changes

Copilot reviewed 55 out of 58 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/Mocha/src/Mocha.Inbox/ (new project) Core inbox library: interface, middleware, cleanup worker, options, feature flag
src/Mocha/src/Mocha.EntityFrameworkCore.Postgres/Inbox/ Postgres inbox implementation: SQL queries, EF Core config, service registration
src/Mocha/src/Mocha.EntityFrameworkCore.Postgres/PostgresTableInfo.cs Refactored: extracted OutboxTableInfo and SagaStateTableInfo to own files, added InboxTableInfo
src/Mocha/src/Mocha.EntityFrameworkCore.Postgres/OutboxTableInfo.cs Extracted from PostgresTableInfo.cs
src/Mocha/src/Mocha.EntityFrameworkCore.Postgres/SagaStateTableInfo.cs Extracted from PostgresTableInfo.cs
src/Mocha/src/Mocha.EntityFrameworkCore.Postgres/InboxTableInfo.cs New table info for inbox messages
src/Mocha/src/Mocha.Threading/ContinuousTask.cs Bug fix: await background task before disposing CTS in DisposeAsync
src/Mocha/src/Mocha/Assembly.cs Added InternalsVisibleTo for Mocha.Inbox
src/Mocha/src/Mocha/README.md Removed internal pipeline documentation
Demo services (Catalog, Billing, Shipping) Added inbox registration, DbContext config, and EF migrations
src/Mocha/src/Examples/Reliability/OutboxInbox/ Updated example to include inbox setup
Test projects (Mocha.Tests, InMemory.Tests, RabbitMQ.Tests, Postgres.Tests) New inbox unit, integration, and behavioral tests
website/src/docs/mocha/v1/reliability.md Major documentation addition for inbox feature
website/src/docs/mocha/v1/index.md Fixed AddPostgresInboxUsePostgresInbox
website/src/docs/mocha/v1/middleware-and-pipelines.md Added inbox to pipeline diagram and middleware list
website/src/docs/mocha/v1/routing-and-endpoints.md Updated next steps link description
website/src/docs/mocha/v1/transports/rabbitmq.md Updated reliability link descriptions
Files not reviewed (3)
  • src/Mocha/src/Demo/Demo.Billing/Migrations/20260307183420_AddInboxMessage.Designer.cs: Language not supported
  • src/Mocha/src/Demo/Demo.Catalog/Migrations/20260307183409_AddInboxMessage.Designer.cs: Language not supported
  • src/Mocha/src/Demo/Demo.Shipping/Migrations/20260307183427_AddInboxMessage.Designer.cs: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Mocha/test/Mocha.Tests/Inbox/ConsumeInboxMiddlewareTests.cs
Comment thread src/Mocha/src/Demo/Demo.Shipping/Program.cs Outdated
Comment thread src/Mocha/src/Demo/Demo.Catalog/Migrations/20260307183409_AddInboxMessage.cs Outdated
Comment thread src/Mocha/src/Demo/Demo.Shipping/Migrations/20260307183427_AddInboxMessage.cs Outdated
Comment thread src/Mocha/src/Demo/Demo.Billing/Migrations/20260307183420_AddInboxMessage.cs Outdated
Comment thread website/src/docs/mocha/v1/reliability.md Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📚 documentation This issue is about working on our documentation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants