Leanpub Header

Skip to main content

Distributed Systems with Python and RabbitMQ

Designing Reliable, Scalable Messaging Architectures for Production

Distributed Systems with Python and RabbitMQ
This book is 100% completeLast updated on 2026-09-12

Build distributed systems that keep working when things go wrong. This hands-on guide shows you how to design reliable messaging architectures with Python and RabbitMQ, from core concepts to production-ready patterns. Follow real projects, write practical code and learn how to build scalable services that recover gracefully under load.

Minimum price

$19.00

$29.00

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
EPUB
WEB
APP
251
Pages
About

About

About the Book

This book teaches intermediate to advanced software engineers how to design, implement, deploy, operate, scale, and maintain robust distributed systems using Python and RabbitMQ. You will move from fundamental concepts of distributed computing through practical messaging patterns to production-ready architectures with complete, runnable code examples. Every chapter builds on the previous one, culminating in real-world projects that demonstrate event-driven microservices, distributed transactions via sagas, and comprehensive observability. By the end, you will have both the theoretical foundation and hands-on experience to build systems that stay reliable under load and recover gracefully from failure.

Author

About the Author

Steve Publications

Steve is a technology professional with over 20 years of experience in software development, server infrastructure, cybersecurity, vulnerability research and reverse engineering. He specializes in analyzing complex systems, identifying weaknesses and improving security.

Beyond his professional work, Steve collaborates with researchers and industry experts to create practical technical books covering software development, cybersecurity, cloud computing, DevOps, AI and enterprise technologies. His goal is to help IT professionals, students and enthusiasts develop practical skills through clear explanations, real-world examples and hands-on exercises.

At Steve Publications, we use AI to assist with translation, proofreading and editing but not to replace the research, technical expertise or hands-on experience behind our books. Some authors publish under pseudonyms for privacy or professional reasons.

Every book is written, reviewed and maintained by experienced professionals, supported by a private community of over 420 engineers and researchers. We prioritize technical accuracy, practical value and regularly updated content over mass-produced AI-generated text.

We welcome experienced professionals interested in writing or reviewing books, especially in specialized and emerging technology fields. If you'd like to contribute, contact us with your area of expertise.

We stand behind our work. If a book doesn't meet your expectations, Leanpub offers a 60-day money-back guarantee.

Contents

Table of Contents

Designing Reliable, Scalable Messaging Architectures for Production

Chapter 1: Why Distributed Systems Matter

  1. The Inevitability of Distribution
  2. What Goes Wrong (and Often Does)
  3. The Cost of Getting It Right
  4. How This Book Is Structured

Chapter 2: Foundations of Distributed Systems

  1. The CAP Theorem (and What It Really Means)
  2. Consistency Models from Strong to Eventual
  3. Fault Tolerance and Failure Modes
  4. Reliability, Availability, Durability
  5. Idempotency as a Design Principle

Chapter 3: Messaging and Communication Patterns

  1. Synchronous vs Asynchronous Communication
  2. Point-to-Point and Queue-Based Messaging
  3. Publish/Subscribe and Event Streaming
  4. Request/Reply Patterns
  5. Event-Driven Architecture Fundamentals

Chapter 4: RabbitMQ Architecture and Core Concepts

  1. Installing and Configuring RabbitMQ
  2. Nodes, Clusters, and Topology
  3. Virtual Hosts and Namespaces
  4. Exchanges and Their Types
  5. Queues, Bindings, and Routing Keys
  6. The Message Lifecycle

Chapter 5: Python Clients and Connection Management

  1. Choosing Your Client Library
  2. Connection Parameters and Heartbeats
  3. Channel Management Best Practices
  4. Async vs Sync Clients
  5. Robust Reconnection Strategies
  6. Resource Cleanup and Graceful Shutdown

Chapter 6: Building Reliable Producers and Consumers

  1. Publishing Messages Correctly
  2. Consumer Acknowledgements and Nacks
  3. Publisher Confirms for Delivery Guarantees
  4. Message Durability and Persistence
  5. Prefetch Tuning and Flow Control
  6. Error Handling Patterns

Chapter 7: Advanced RabbitMQ Features

  1. Priority Queues for Critical Workloads
  2. Delayed and Scheduled Messaging
  3. Dead-Letter Exchanges and Retry Strategies
  4. Message Time-to-Live and Expiration
  5. RabbitMQ RPC Pattern Implementation
  6. Queue Arguments and Advanced Configuration

Chapter 8: Designing Robust Distributed Systems

  1. Retry Strategies with Exponential Backoff
  2. Circuit Breaker Pattern Implementation
  3. The Saga Pattern for Distributed Transactions
  4. Idempotent Consumer Design
  5. Message Ordering Guarantees
  6. Handling Duplicate and Out-of-Order Messages

Chapter 9: Project One - Production Task Queue System

  1. Requirements and Architecture Decisions
  2. Project Structure and Configuration
  3. Task Serialization and Schema Design
  4. Worker Implementation with Graceful Shutdown
  5. Retry Logic and Dead-Letter Handling
  6. Testing the Task Queue System
  7. Docker and Deployment Configuration

Chapter 10: Event-Driven Microservices with CQRS

  1. Microservice Communication via Events
  2. Implementing the CQRS Pattern
  3. Event Sourcing Integration Concepts
  4. Inter-Service Saga Orchestration
  5. Domain Events and Event Versioning
  6. Handling Schema Evolution

Chapter 11: Observability in Production

  1. Structured Logging for Distributed Systems
  2. Metrics Collection with Prometheus
  3. Distributed Tracing with OpenTelemetry
  4. Health Checks and Readiness Probes
  5. Debugging Message Flow Issues
  6. Correlation IDs Across Services

Chapter 12: Security, Authentication, and Authorization

  1. TLS/SSL Encryption End-to-End
  2. User Authentication and Password Policies
  3. Authorization and Access Control
  4. VHost Isolation Strategies
  5. Secrets Management in Production
  6. Network Security and Firewalls

Chapter 13: Deployment, Scaling, and High Availability

  1. Docker and Docker Compose Setup
  2. RabbitMQ Clustering Fundamentals
  3. Quorum Queues for High Availability
  4. Federation and Shovel Plugins
  5. Kubernetes Deployment Patterns
  6. Performance Tuning and Capacity Planning

Chapter 14: Production Pitfalls and Troubleshooting

  1. Memory Pressure and Flow Control
  2. Disk Alarms and Storage Management
  3. Diagnosing Consumer Lag
  4. Connection Storms and Resource Exhaustion
  5. Split-Brain Scenarios
  6. Systematic Troubleshooting Methodology

Conclusion

References

Get the free sample chapters

Click the buttons to get the free sample in PDF or EPUB, or read the sample online here

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub