Leanpub Header

Skip to main content

Spring, RabbitMQ, and Modern Java Platform Engineering

Designing, Building, and Operating Reliable Distributed Systems

Spring, RabbitMQ, and Modern Java Platform Engineering
This book is 100% completeLast updated on 2026-09-27

Build reliable distributed systems with Spring Boot, RabbitMQ and modern Java. Follow OrderFlow as it grows from a simple service into a production-ready event-driven platform, exploring architecture, messaging, observability, containers and the practical trade-offs behind every design decision.

Minimum price

$19.00

$29.00

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
EPUB
WEB
APP
186
Pages
About

About

About the Book

This book is a complete technical guide to building distributed systems with Spring Boot, RabbitMQ, and modern Java. It takes you from the fundamental architectural principles that govern reliable distributed applications through the internals of each technology and into the practices required to operate production-grade platforms at scale. A realistic reference application, an order processing platform called OrderFlow, evolves throughout the book from a simple service into a fully event-driven, containerized, observable microservice architecture. Every chapter includes complete, production-quality code, infrastructure configurations, and detailed explanations of why each architectural choice was made, what trade-offs it introduces, and how it affects the behavior of the overall system.

Author

About the Author

Steve Publications

Steve is a technology professional with more than 20 years of experience in software development, server infrastructure, cybersecurity, vulnerability research and reverse engineering. Throughout his career, he has designed, secured, analyzed and tested complex software and infrastructure, with a particular focus on understanding how systems fail and how they can be made more secure.

Outside of work, Steve enjoys sharing knowledge with the technology community. He collaborates with researchers, industry experts and technology professionals to write practical books covering software development, cybersecurity, cloud computing, networking, DevOps, artificial intelligence and enterprise technologies. His books focus on practical learning through clear explanations, real-world examples and hands-on exercises. With more than two decades of industry experience, his goal is to help IT professionals, students and technology enthusiasts build useful skills and stay current in a rapidly changing industry.

We believe readers deserve to know how our books are created. Most of our authors are not native English speakers, so we use AI to help translate, proofread manuscripts, fix grammar, improve sentence structure and make technical explanations easier to read. AI is used as an editing tool only. It does not replace the research, technical knowledge or hands-on experience behind our books. Some of our authors also prefer to remain anonymous for privacy or professional reasons. In those cases, we publish their work under a different name. The author's name may be different, but the quality of the content and our review process remain the same.

Every book is written, reviewed and maintained by experienced technology professionals, with contributions from our private technical community of more than 420 engineers and researchers. We spend far more time validating technical accuracy and keeping our content up to date than generating text. We are always interested in working with experienced professionals who have deep expertise in a particular technology or domain. If you would like to publish a book with us or help review an existing manuscript, we'd love to hear from you. Send us a message describing your area of expertise. We are especially interested in niche technologies, specialized skills and emerging topics that are underrepresented in existing technical literature.

If you look through the contents of our books, you'll see practical examples, detailed explanations and material that is regularly updated. Our goal is to publish books that professionals can actually rely on, not low-effort AI-generated content. If you ever feel that one of our books does not meet that standard, Leanpub offers a 60-day money-back guarantee. Feel free to request a refund if you are not satisfied with your purchase.

Contents

Table of Contents

Designing, Building, and Operating Reliable Distributed Systems

Introduction

  1. What This Book Covers
  2. How This Book Is Structured
  3. Who Should Read This Book
  4. The Philosophy Behind This Book

Chapter 1: The Reality of Distributed Systems

  1. The Moment Everything Changes
  2. The Fundamental Tensions: Consistency, Availability, and Partition Tolerance
  3. Latency, Concurrency, and Partial Failure
  4. Why “Just Add a Message Broker” Is Not an Answer
  5. Communication Models: RPC, Messaging, Events, and Their Trade-offs
  6. The Operational Dimension: What Production Really Demands
  7. Introducing OrderFlow: Our Reference Platform

Chapter 2: Modern Java for Platform Engineering

  1. Why Java Matters for Distributed Systems
  2. Java 21 Features That Matter: Records, Sealed Classes, Pattern Matching, Virtual Threads
  3. JVM Fundamentals for Production: Memory Model, Garbage Collection, Tuning Basics
  4. Build Tooling: Maven, Modularization, and Dependency Management
  5. Concurrency in Java: Executors, Virtual Threads, Structured Concurrency
  6. Structured Logging and Observability-Ready Code
  7. Defensive Programming: Null Safety, Immutable Data, and Failure Handling

Chapter 3: Architectural Principles and Patterns

  1. From Monolith to Distributed: When and Why to Break Apart
  2. Domain-Driven Design: Bounded Contexts, Ubiquitous Language, and Strategic Design
  3. Event-Driven Architecture: Core Concepts and Anti-Patterns
  4. Microservices and Service-Oriented Architecture: Truths and Misconceptions
  5. Synchronous vs Asynchronous: Choosing the Right Communication Style
  6. Designing for Failure: Resilience Patterns and Graceful Degradation

Chapter 4: Spring Boot for Production Systems

  1. How Spring Boot Works: Auto-Configuration, Starters, and the Application Context
  2. Dependency Injection and the Component Model
  3. Configuration Management: Profiles, Externalization, and Hierarchies
  4. REST with Spring Web MVC and WebFlux
  5. Actuator: Health, Metrics, and Production Visibility
  6. Lifecycle Management and Graceful Shutdown

Chapter 5: Data Access and Persistence with Spring Data

  1. Spring Data JPA: Entities, Repositories, and Query Methods
  2. Transaction Management: Propagation, Isolation, and Distributed Considerations
  3. Database Migrations with Flyway
  4. Connection Pooling and Performance
  5. Choosing Persistence Technologies: Relational vs Document vs Specialized Stores
  6. Persistence Anti-Patterns and Pitfalls

Chapter 6: RabbitMQ Fundamentals

  1. RabbitMQ Architecture: Broker, Nodes, Clusters, and the Management Layer
  2. The AMQP Protocol: Concepts, Versioning, and Alternatives
  3. Connections, Channels, and Resource Management
  4. Queues, Exchanges, and Bindings: The Core Data Model
  5. Message Flow and Lifecycle
  6. RabbitMQ Management: UI, HTTP API, and CLI Tools

Chapter 7: Exchange Types, Routing, and Topology Design

  1. Direct Exchanges: Point-to-Point Routing
  2. Fanout Exchanges: Broadcasting and Multicast
  3. Topic Exchanges: Pattern-Based Routing and Hierarchies
  4. Headers Exchanges and Use Cases
  5. Designing Exchange and Queue Topologies for OrderFlow
  6. Virtual Hosts, Namespaces, and Multi-Tenancy

Chapter 8: Message Delivery Semantics and Reliability

  1. At-Least-Once, At-Most-Once, and Exactly-Once: What They Really Mean
  2. Publisher Confirms: Ensuring Messages Reach the Broker
  3. Consumer Acknowledgments: Manual vs Automatic, Negative Acknowledgments
  4. Message Durability: Persistent Messages and Queue Durability
  5. Transactional Publishing: AMQP Transactions and Trade-offs
  6. Implementing Reliable Delivery in OrderFlow

Chapter 9: Advanced Messaging Patterns with RabbitMQ

  1. Dead Letter Exchanges and Queues: Handling Failed Messages
  2. Message Timeouts and TTL-Based Expiration
  3. Delayed Message Processing with Plugins and Alternatives
  4. Priority Queues and Work Prioritization
  5. Queue Length Limits and Overflow Handling
  6. Message Inspection and Redelivery Control

Chapter 10: RabbitMQ Clustering, High Availability, and Scaling

  1. RabbitMQ Clustering: Architecture, Topologies, and Quorum
  2. HA Queues and Quorum Queues: Choosing the Right Model
  3. Scaling Out: Adding Nodes, Rebalancing, and Monitoring
  4. Broker Upgrades and Maintenance Procedures
  5. Disaster Recovery Strategies and Data Backup
  6. Performance Tuning: Memory, Disk, and Erlang Considerations

Chapter 11: Spring AMQP Fundamentals

  1. The Spring AMQP Abstraction: RabbitTemplate, ConnectionFactory, and Channel
  2. Configuring RabbitMQ Connections in Spring Boot
  3. Sending Messages: RabbitTemplate and Producer Configuration
  4. Receiving Messages: RabbitListener and Consumer Configuration
  5. Message Conversion and Serialization
  6. Error Handling Fundamentals: DefaultErrorHandler and Beyond

Chapter 12: Building Reliable Producers with Spring AMQP

  1. Publisher Confirms and Returns in Spring AMQP
  2. ConfirmsCallback and ReturnCallback: Handling Broker Feedback
  3. Retry Semantics: SimpleMessageConverter and RetryTemplate Integration
  4. Correlation IDs and Message Tracing
  5. Batching and Bulk Publishing
  6. Producer Performance and Throughput Optimization

Chapter 13: Building Reliable Consumers with Spring AMQP

  1. Acknowledgment Modes: AUTO, MANUAL, and BATCH
  2. Concurrency Tuning: Prefetch, Consumer Threads, and Queue Partitioning
  3. The DefaultMessageListenerContainer Lifecycle and Configuration
  4. Consumer Error Handling: Retry, Backoff, and DLQ Routing
  5. Idempotent Consumer Design
  6. Graceful Consumer Shutdown and Message In-Flight Handling

Chapter 14: Message Serialization, Schema Evolution, and Compatibility

  1. JSON Serialization with Jackson: Configuration and Customization
  2. Avro and Schema Registry for Contract-Governed Messages
  3. Protobuf and Performance-Sensitive Scenarios
  4. Schema Evolution Strategies: Backward, Forward, and Full Compatibility
  5. Versioning Messages and Supporting Multiple Consumers
  6. Message Schema Documentation and Governance

Chapter 15: Event-Driven Design and the Outbox Pattern

  1. Domain Events and Integration Events: Defining the Distinction
  2. The Transactional Outbox Pattern: Theory and Implementation
  3. Implementing Outbox with Spring Data and Polling
  4. CDC-Based Outbox: Debezium and Change Data Capture
  5. Event Publishing in OrderFlow: From Database to RabbitMQ
  6. Testing Event-Driven Components

Chapter 16: The Inbox Pattern and Idempotent Processing

  1. Why Idempotency Matters: Duplicate Detection and Processing
  2. The Inbox Pattern: Tracking Received Messages
  3. Implementing Idempotency Keys and State Stores
  4. Outbox-Inbox: End-to-End Reliable Communication
  5. Handling Partial Failures and Compensating Actions
  6. Idempotency in OrderFlow Services

Chapter 17: Sagas and Distributed Transactions

  1. Why Distributed Transactions Fail: Two-Phase Commit and Its Problems
  2. Saga Pattern: Choreography vs Orchestration
  3. Implementing Sagas with RabbitMQ and Spring Events
  4. Compensating Actions and Rollback Semantics
  5. Saga State Machines and Persistence
  6. OrderFlow Saga: Implementing an Order Fulfillment Workflow

Chapter 18: Message Ordering and Sequence Guarantees

  1. When Ordering Matters and When It Does Not
  2. FIFO Queues and Single-Consumer Constraints
  3. Partitioning by Key for Ordered Substreams
  4. Sequence Numbers and Gap Detection
  5. Implementing Order Guarantees in RabbitMQ
  6. Ordering Trade-offs: Throughput vs Determinism

Chapter 19: Concurrency, Backpressure, and Flow Control

  1. Understanding Throughput, Latency, and Saturation
  2. Backpressure Mechanisms: Prefetch, Queue Limits, and Rate Limiting
  3. Spring AMQP Flow Control and Consumer Throttling
  4. Circuit Breakers and Bulkheads: Protecting Services
  5. Implementing Flow Control in OrderFlow
  6. Capacity Planning and Load Testing

Chapter 20: Security, Authentication, and Authorization

  1. RabbitMQ Security: Users, VHosts, Permissions, and TLS
  2. Spring Security with OAuth2 and JWT
  3. Service-to-Service Authentication Patterns
  4. Secrets Management: Vault, Kubernetes Secrets, and Environment Config
  5. Encrypting Data in Transit and at Rest
  6. Security Testing and Compliance

Chapter 21: Observability — Logging, Metrics, and Tracing

  1. Structured Logging with Micrometer and Logback
  2. Metrics with Micrometer: Gauges, Counters, Timers, and Histograms
  3. Distributed Tracing with Micrometer Tracing and Brave/OpenTelemetry
  4. Correlating Logs, Metrics, and Traces
  5. RabbitMQ Metrics and Broker Visibility
  6. Implementing Observability in OrderFlow

Chapter 22: Containerization, Kubernetes, and Deployment

  1. Docker Images for Spring Boot Applications
  2. Docker Compose for Local Development and Integration Testing
  3. Kubernetes Deployments, Services, and ConfigMaps
  4. RabbitMQ on Kubernetes: Helm Charts and Operators
  5. Ingress, Networking, and Service Mesh Considerations
  6. Deployment Strategies: Rolling, Blue-Green, and Canary

Chapter 23: Testing Strategy for Distributed Systems

  1. Unit Testing Spring and RabbitMQ Components
  2. Integration Testing with Testcontainers: RabbitMQ, Databases, and More
  3. Contract Testing with Spring Cloud Contract
  4. End-to-End Testing in an Isolated Environment
  5. Testing Failure Scenarios: Network Partition, Broker Down, Slow Consumers
  6. Test Infrastructure and CI Pipelines

Chapter 24: CI/CD, Automation, and Release Engineering

  1. CI Pipeline Design: Build, Test, and Quality Gates
  2. Container Registry and Image Tagging Strategy
  3. CD Strategies and Automated Deployments
  4. Environment Promotion and Feature Flags
  5. Rollback Procedures and Release Management
  6. The OrderFlow CI/CD Pipeline

Chapter 25: Troubleshooting, Maintenance, and Long-Term Evolution

  1. Common Failure Modes and Their Symptoms
  2. RabbitMQ Troubleshooting: Connections, Queues, Memory, and Disk
  3. Spring Boot Troubleshooting: Memory Leaks, Thread Pools, and Timeouts
  4. Incident Response and Debugging Production Issues
  5. Dependency Management and Version Upgrades
  6. Technical Debt, Refactoring, and Architectural Evolution

Chapter 26: The Production OrderFlow Platform

  1. Full Architecture: Services, Events, and Flows
  2. Production Deployment: Complete Kubernetes and Infrastructure Configuration
  3. Operational Runbook: Monitoring, Scaling, and Incident Response
  4. Performance Characteristics and Capacity Profiles
  5. Evolutionary Roadmap: How the Architecture Could Grow
  6. Lessons Learned and Key Takeaways

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.)

In fact, authors have earned over $15 million writing, publishing and selling 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