RabbitMQ in Depth cover

RabbitMQ in Depth

Rating 3.5
Word count
302 words
Chapters
40
ISBN
9787121341809

Tags

Summary

RabbitMQ in Depth is the simplified Chinese translation of Manning's RabbitMQ in Depth, aimed at developers who already have a basic understanding of message-oriented systems, and offers a systematic explanation of how RabbitMQ, a mainstream message broker, works and how to use it in engineering practice. The book consists of three parts. Part 1, "RabbitMQ and Application Architecture," begins with RabbitMQ's relationship to Erlang and the AMQP protocol and explains its value in loosely coupled architectures; it then dissects AMQP's frame structure as an RPC transport mechanism and writes publisher and consumer examples in Python; next it breaks down message properties one by one—content-type and the message contract, compressing message bodies with gzip and content-encoding, message-id and correlation-id for correlating requests and responses, timestamp, message expiration, the trade-off between speed and durability in delivery-mode, app-id and user-id, type, reply-to, custom message headers, and priority; it then discusses the performance trade-offs of publishing messages and back pressure, and why one should "consume messages rather than pull them," including the comparison between Basic.Consume and Basic.Get, consumer performance optimization, message rejection, and queue control; finally it covers routing patterns and performance benchmarks around direct, fanout, topic, and headers exchanges as well as the consistent-hash exchange. Part 2 discusses clustering and cross-cluster distribution, including cluster setup, federation exchanges and federated queues, and connecting to upstream nodes for distributing messages across multiple data centers or cloud environments. Part 3 covers integration and customization, introducing communication with RabbitMQ via MQTT, STOMP, and HTTP, and database integration through pg_amqp, listening to PostgreSQL notifications, and writing to InfluxDB. The book ends with an appendix on setting up an environment with VirtualBox and Vagrant, so readers can reproduce the examples hands-on.

Editor's review

市面上讲 RabbitMQ 的中文书不少,但大多数停留在「怎么装、怎么发消息」的操作层面;这本书的独特之处在于它一直在回答「为什么」。作者 Gavin M. Roy 是长期活跃在开源社区的技术人,他从 AMQP 协议的帧结构讲起,把一个消息从生产者发出、经过交换器路由、到被消费者确认的完整链路拆开给你看,读完再看配置文件里的参数,会明白每个参数背后在权衡什么。全书三个部分层层递进:第一部分打牢协议与消息属性、发布消费、路由模式的基本功,其中关于 delivery-mode、消息过期、back pressure 回推、Basic.Get 与 Basic.Consume 取舍的讨论尤其值得反复咀嚼;第二部分讲集群与跨集群联合,正好对应多机房、混合云这类真实场景;第三部分用 MQTT、STOMP、HTTP 和数据库集成展示 RabbitMQ 作为「消息枢纽」的延展性。示例代码用 Python 编写,不绑定某一门语言的框架,Java、Go、Node.js 的使用者都能顺畅迁移。译者汪佳南、郑天民分工合译,术语统一、行文准确。需要提醒的是,原书英文版出版于 2017 年,中文版 2018 年上市,RabbitMQ 在这几年间版本迭代较快(如仲裁队列等新特性),读时宜对照官方最新文档,把书中原理作为理解框架,具体配置项以现行版本文档为准。

Who it's for

A good fit for

  • 已经会用 RabbitMQ 收发消息,想弄清 AMQP 协议与内部机制的后端开发者
  • 正在设计微服务或分布式系统、需要选型消息中间件的架构师
  • 负责 RabbitMQ 部署与排障,希望系统掌握集群与跨机房方案的运维人员
  • 计算机相关专业研究生、本科生,作为消息中间件课程或项目的参考读物

Not a good fit for

  • 完全没接触过消息队列、需要手把手入门的零基础读者
  • 只想找一本与当前 RabbitMQ 最新版本配置项严格对应的速查手册的人
  • 不写代码、只关心业务产品设计的产品与运营人员

Reading tips

  1. 先读第 1、2 章建立 AMQP 协议与帧结构的整体印象,再进入消息属性章节,避免被细节淹没。
  2. 把附录的环境搭建做一遍,用 Vagrant 起本地集群,边读边跑第 3 至 6 章的示例,效果远胜纯阅读。
  3. 第 3 章的消息属性建议做成自己的速查表,与项目里实际使用的属性逐条对照。
  4. 书中版本较早,读到集群、流控相关内容时同步查阅 RabbitMQ 官方文档,标注差异再落地。

About the publisher

Publishing House of Electronics Industry China · Founded in 1982

The Publishing House of Electronics Industry is a comprehensive publisher distinguished by its focus on electronic information and related fields. Judging from the more than 3,000 titles in its catalogue, its publishing covers programming and design, artificial intelligence, computer science, finance and economics, photography, and social sciences, attending both to cutting-edge technology and to general readers. Representative titles include Factor Investing: Methods and Practice, x86 Assembly Language: From Real Mode to Protected Mode, The RISC-V Reader, Artificial Intelligence: Speech Recognition, Understanding and Practice, Phased Array Radar Technology, Radar Target Characteristics, and 100 Go Mistakes and How to Avoid Them, most of which centre on technical methods and engineering practice. Its authors include Shi Chuan, Li Zhong, Wang Xiaobo, David Patterson, Andrew Waterman, and Yu Zihao, among others from China and abroad. Owing to limited public information, no further publishing features are elaborated here.

Contents

  1. Translator's Preface
  2. Foreword
  3. Acknowledgments
  4. About This Book
  5. Part 1 RabbitMQ and Application Architecture
  6. Chapter 1 RabbitMQ Basics
  7. 1.1 RabbitMQ Features and Benefits
  8. 1.2 Who Uses RabbitMQ and How
  9. 1.3 The Advantages of Loosely Coupled Architectures
  10. 1.4 Summary
  11. Chapter 2 Interacting with Rabbit Using the AMQP Protocol
  12. 2.1 AMQP as an RPC Transport Mechanism
  13. 2.2 The AMQP RPC Frame Structure
  14. 2.3 Using the Protocol
  15. 2.4 Writing a Message Publisher in Python
  16. 2.5 Getting Messages from RabbitMQ
  17. 2.6 Summary
  18. Chapter 3 Message Properties in Detail
  19. 3.1 Using Properties Appropriately
  20. 3.2 Using the content-type Property to Create an Explicit Message Contract
  21. 3.3 Compressing Message Size with gzip and the content-encoding Property
  22. 3.4 Using message-id and correlation-id to Reference Messages
  23. 3.5 Creation Time: The timestamp Property
  24. 3.6 Automatic Message Expiration
  25. 3.7 Using delivery-mode to Balance Speed and Safety
  26. 3.8 Using app-id and user-id to Verify Message Origin
  27. 3.9 Using the type Property to Get Details
  28. 3.10 Using the reply-to Property to Implement Dynamic Workflows
  29. 3.11 Using Message Headers for Custom Properties
  30. 3.12 The Priority Property
  31. 3.13 Properties You Cannot Use: cluster-id/reserved
  32. 3.14 Summary
  33. Chapter 4 Performance Trade-offs in Publishing Messages
  34. 4.1 Balancing Delivery Speed and Reliable Delivery
  35. 4.2 RabbitMQ Back Pressure
  36. 4.3 Summary
  37. Chapter 5 Consuming Messages, Avoiding Pulling
  38. 5.1 Comparing Basic.Get and Basic.Consume
  39. 5.2 Optimizing Consumer Performance
  40. 5.3 Rejecting Messages

FAQ

这本书和《RabbitMQ实战指南》有什么区别?
《RabbitMQ实战指南》是国人撰写,偏重安装、配置、运维与原理的中文原创书;《深入RabbitMQ》是 Manning《RabbitMQ in Depth》的译本,更强调协议层面的「为什么」,从 AMQP 帧、消息属性到路由与集群逐层展开,适合作为理解机制的补充读物。
零基础能直接读这本书吗?
不太建议。原书在前言中说明面向「对面向消息的系统有基本了解的程序员」。如果没有用过消息队列,建议先用官方教程跑通发布与消费,再回来读本书,否则第 2 章的帧结构和第 3 章的消息属性会相当吃力。
书里的例子用什么语言写?
主要使用 Python 编写发布者与消费者示例,并展示如何通过 AMQP 客户端库与 RabbitMQ 交互。由于重点是协议与机制而非框架,Java、Go、Node.js 等语言的开发者可以较容易地把示例迁移到自己的技术栈。
内容是否已经过时?
英文原版出版于 2017 年、中文版 2018 年,AMQP 协议模型、交换器类型、消息属性等原理性内容依然成立;但 RabbitMQ 后续版本新增的仲裁队列、流等特性书中没有覆盖,配置细节需以官方最新文档为准。
书里讲的集群方案适用于多机房吗?
第二篇专门讨论跨集群消息分发,介绍联合交换器(federation exchange)、联合队列以及连接上游节点的做法,正是为多数据中心或云环境准备的。不过具体部署仍需结合自身网络延迟与运维条件评估。

Comments

Find this book

This site is an index: you start “Search all sources” in your browser, and the entries it lists all point to third-party sites; please judge their availability yourself.

About the author

Gavin M. Roy Author

Gavin M. Roy is a computer technology author about whom limited public information is available; his nationality, dates of birth and death, and personal background are not clearly recorded. According to the library's holdings, the work through which Chinese readers can encounter him is Deep Dive into RabbitMQ, a technical book categorized under computer science and programming design that focuses on message-oriented middleware. In this single work, Roy's writing centers on the practical use of RabbitMQ, emphasizing the combination of messaging concepts, configuration, and development practice, with an operational tone suited to developers who need to understand or get started with the technology. Given the available materials, a fuller assessment of his overall body of work and stylistic development is difficult, yet through Deep Dive into RabbitMQ alone he has offered Chinese-language technical readers a concrete and practical point of entry that they can use as needed.