.NET Architecture & System Design Interview Question #92

What problem does the Inbox Pattern solve?

Transactions, CQRS, Event Sourcing & Distributed Consistency Mid-Level Intermediate

Quick Interview Answer

The Inbox Pattern records incoming message identifiers or processing state so a consumer can recognize messages it has already handled. It is commonly used to make at-least-once message delivery safe.

Detailed Explanation

The Inbox Pattern records incoming message identifiers or processing state so a consumer can recognize messages it has already handled. It is commonly used to make at-least-once message delivery safe.

The business update and inbox record should be coordinated within an appropriate transaction when possible. Retention and cleanup policies are also needed as the inbox grows.

Code Example

Receive Message 123

if Inbox contains 123:
    skip
else:
    process business change
    save Inbox 123