Chapter 29
Review a complete messaging design
Produce a topology, protocol, failure matrix, resource budget and validation plan.
Prerequisite: Where does replay come from?. Course map →
The situation
The shop needs current prices, background work and customer notifications. Each small socket pattern works in isolation. The design task is to connect them without losing the distinctions that made the experiments meaningful.
Choose patterns from requirements
Write the observable business questions and freshness/completion needs first. Choose request/reply, publications, work pipelines and routing for specific interactions. State which data must survive loss of all processes and where that durable authority resides.
Draw process/context/socket ownership, endpoints, security boundaries and data movement. Name route, worker, logical job, assignment and correlation identities independently. Specify frames, versions, units, size limits and error outcomes.
Budget the whole topology
Account for offered/admitted/completed/rejected work, bytes and frames, fan-out, pending IDs, socket/application buffers, cache cardinality and monitoring volume. Include retries, repair and snapshots in the workload.
Name measured versus assumed quantities and the boundary of each benchmark. Reserve capacity and retained history for recovery. A high send rate on an empty inproc pipe cannot justify the capacity or freshness of a multi-host durable workflow.
Evidence for recovery
Illustrative case.
Pick one shop interaction. What evidence would you need before trusting its recovery claim?
| Boundary | Useful evidence | Remaining question |
|---|---|---|
| Live prices | PUB/SUB + defined rebuild | Versioned snapshot/live contract |
| Background work | Pipelines/routing + ownership | Durable recovery and duplicate effects |
| Customer notification | Identified request/result | External idempotency/reconciliation |
| Release decision | Tested topology and limits | Named owners and failure evidence |
Make the failure cuts explicit
For each crash point, write down what you could still observe. Include a crash after the handler acts but before it replies, and one after the reply but before the reader saves its position. Include worker reassignment, the switch from a snapshot to live updates and a retry after processed IDs expire. Define bounded retry, cancellation, reconciliation and escalation owners.
A sound design can combine durable logs, idempotent services, inbox/outbox transactions, versioned views and explicit fencing, but each closes a particular boundary. Use the actual selected mechanism and test it rather than giving the whole diagram an exactly-once label.
Prepare release and operations evidence
Submit normal and boundary fixtures, protocol compatibility cases, denied security operations, load/backlog measurements, failure injections and restart/cutover rehearsals. Include unfinished work and duplicate receipts in observability, not only successful results.
Assign an owner and a procedure for stopping admission, finishing queued work and checking unknown outcomes. Also say who handles messages that fail repeatedly, renews keys and rebuilds state if history is gone. In the capstone, identify the first event that differs between runs and propose tests for the actual deployment. Running every lesson is a useful starting point, not a certificate of production readiness.
Check your understanding
You plan to deploy a repair for a lost charge receipt. Which three failure tests would you run, and what outcome would show that the repair failed?
Show hints
Hint 1
Try losing the reply immediately after the charge.
Hint 2
Try restarting, then try repeating the request after its saved ID expires.
Show explanation
Test losing the reply after the charge, repeating the same ID after a restart, and repeating it after the ID record expires. Compare request IDs, receipts and recorded charges. A missing charge, a repeated charge or an outcome that cannot be checked would show where the recovery claim fails.
ReferencesPrimary sources for this chapter’s design case
Use these guides to check the framework or protocol contract discussed in this chapter. Moving “stable” or “current” guides can describe a different release; check the version used by your deployment. These readings do not execute the distributed frameworks they compare.
ZeroMQ Guide
ZeroMQ API reference