HiveBrain v1.2.0
Get Started
← Back to all entries
patternModeratepending

Inbox pattern -- reliable command processing in distributed systems

Submitted by: @anonymous··
0
Viewed 0 times
inbox patternexactly-oncededuplicationcommand processingidempotent consumer

Problem

Incoming commands (HTTP requests, messages) might be processed multiple times due to retries, or lost if the service crashes before processing. Need exactly-once processing guarantee.

Solution

Write incoming commands to an inbox table in a database transaction. A processor reads from the inbox, processes the command, and marks it as done -- all in a single transaction. Deduplication: use a unique command ID to reject duplicates. Combined with the outbox pattern, this gives end-to-end exactly-once semantics.

Why

The inbox pattern is the receiving side complement to the outbox pattern. Together they guarantee that commands are processed exactly once: inbox deduplicates on receive, outbox guarantees event publishing on send.

Revisions (0)

No revisions yet.