Messaging Patterns LabPython · ZeroMQ

Hands-on Python lessons

Messaging patterns
with ZeroMQ.

Send requests, publish updates and route work between processes. Learn how queues, timeouts and retries affect delivery and completion.

20 runnable lessons 10 design readings Basic Python

Course contents

Part 1

Messages and conversations

Send requests, preserve frames and follow each socket pattern’s rules.

  1. 01Send a request to another processConnect, send and receive a reply.Lab
  2. 02Preserve message boundariesBytes, frames and messages are different units.Lab
  3. 03Respect the REQ state machineA request socket waits for its reply before sending again.Lab
  4. 04Send work down a pipelineSend work in one direction and check what reached the receiver.Lab
  5. 05What completed when send returned?Identify what the sender and receiver know at each step of a request.Reading
  6. 06Who owns the socket?Choose context, thread/process ownership, transport and shutdown boundaries.Reading
Part 2

Publications and state

Subscribe to updates and handle data you missed.

  1. 07Filter a publicationMatch the first bytes of a topic name.Lab
  2. 08Meet the late subscriberFind out what a subscriber receives when it joins late.Lab
  3. 09Detect a sequence gapFind missing sequence numbers in a live feed.Lab
  4. 10Replay a cached valueGive a new subscriber the current value.Lab
  5. 11How does a late reader catch up?Design a snapshot/live handoff with versions, gaps and deletes.Reading
Part 3

Capacity and lifecycle

Handle full queues, timeouts and shutdown.

  1. 12Receive without blockingDistinguish no message from a message with zero bytes.Lab
  2. 13Bound a socket queueWatch a sender reach a queue limit.Lab
  3. 14Choose connection and close policySee what a socket accepts while no receiver is connected.Lab
  4. 15Where is the unfinished work?Measure a stated boundary and budget bytes, queues, fan-out and recovery.Reading
  5. 16What does silence tell you?Decide what to do when a reply or a worker’s check-in is late.Reading
Part 4

Routing and worker patterns

Route replies and distribute work to available workers.

  1. 17Route an envelopeAddress a reply to the right connection.Lab
  2. 18Reject an unknown routeAsk the router to report an unknown destination.Lab
  3. 19Match out-of-order repliesUse request IDs to match replies.Lab
  4. 20Forward through a real proxyFollow a request through a forwarding process.Lab
  5. 21Dispatch with worker creditSend a job only when a worker has room.Lab
  6. 22When does a worker own a job?Separate transient routes, readiness, assignment identity and effect ownership.Reading
Part 5

Reliability and security

Retry safely and protect connections.

  1. 23Retry with stable identityCompare repeated requests with repeated charges.Lab
  2. 24What is the wire contract?Specify which message bytes each side sends, what they mean and how those rules can change.Reading
  3. 25Encrypt a connectionSeparate an encrypted exchange from permission to act.Lab
  4. 26Who may issue the request?Connect encrypted transport to identity, authorization, secrets and data lifecycle.Reading
Part 6

Operations and integration

Observe connections and combine messaging with durable logs.

  1. 27Observe a connectionDistinguish a working connection from a completed request.Lab
  2. 28Where does replay come from?Compose ZeroMQ messaging with a durable source without inventing atomic commits.Reading
Part 7

Design review and capstone

Review a design, then diagnose a missing receipt.

  1. 29Review a complete messaging designProduce a topology, protocol, failure matrix, resource budget and validation plan.Reading
  2. 30Diagnose the missing receiptTrace the outcome of a request whose first reply never arrives.Lab

Continue with event streaming

Explore retained logs, event-time windows and stateful recovery in Event Streaming Lab →