- RabbitMQ Essentials
- Lovisa Johansson David Dossot
- 1250字
- 2021-06-11 18:49:49
Preface
RabbitMQ is a message broker, providing a communication structure between components and services. Thanks to the Advanced Message Queuing Protocol (AMQP) and all available RabbitMQ client libraries, most major programming languages and services are able to work together seamlessly, in an asynchronous manner.
This book explores the powerful possibilities of RabbitMQ by delving into the basic fundamentals through the user journey of Complete Car (CC), a fictitious taxi dispatch company with real-life user requirements.
Who this book is for
If you are a professional enterprise developer or someone who just codes for fun, RabbitMQ Essentials is a valuable resource on open source message queue architecture. Even those who are already familiar with microservices and messaging will discover value in reading this book for an exploration of moving forward with best practices and resource efficiency. This book will give you the push you need to get started with creating new and exciting applications or migrating existing monoliths to a microservice architecture.
What this book covers
Chapter 1, A Rabbit Springs to Life, is an introduction to RabbitMQ, how to get started, and the benefits of message queues. The chapter then instructs you on how to install and configure RabbitMQ and the preparation for going forward with developing applications.
Chapter 2, Creating a Taxi Application, discusses the creation of a simple taxi order application using RabbitMQ. By the end of this chapter, expect to have an understanding of how to connect to RabbitMQ, publishing with direct and topic exchanges, and consuming messages from queues. The chapter also explains message acknowledgments and negative acknowledgments (acks and nacks).
Chapter 3, Sending Messages to Multiple Taxi Drivers, moves on with the CC project, providing information on the prefetch value settings, which control the number of messages that are being sent to the consumer at the same time. This chapter also covers how consumers can manually acknowledge messages, recommendations for developing a zero-message loss design, and how to receive messages without acknowledgments. The chapter closes by providing you with a good understanding of the fanout exchange.
Chapter 4, Tweaking Message Delivery, is about message time-to-live (TTL), using message property name expiration, and other important topics about tweaking message delivery, including dead-letter exchanges and queues.
Chapter 5, Message Routing, dives deeper into message flow, covering how to respond to a sender and how header exchange can be used to perform the property-based routing of messages. Additionally, request-response styles of interactions are also explained.
Chapter 6, Taking RabbitMQ to Production, presents different strategies that can be used to deal with the failure of a RabbitMQ broker. Topics include clustering, quorum queues, and federation. This chapter also covers a very important aspect of RabbitMQ – log processing and data analysis.
Chapter 7, Best Practices and Broker Monitoring, funnels down all the great information in the preceding chapters into best practices and key takeaways that can be used in real-world application development. This final chapter also explains common errors in RabbitMQ and provides strategies to put in place to monitor system performance and avoid catastrophic situations.
To get the most out of this book
How to install RabbitMQ on Ubuntu and via Docker is explained in Chapter 1, A Rabbit Springs to Life. It also gives suggestions about how to set up a hosted version of RabbitMQ through CloudAMQP.
The code in the book is easy to follow even if you are not familiar with Ruby or Python. All the code examples in Ruby have been tested using Ruby 2.7, and all the code examples in Python have been tested using Python 2.7, on macOS. However, they should probably work with future version releases too.

If you are using the digital version of this book, we advise you to type the code yourself or access the code via the GitHub repository (link available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code.
Download the example code files
You can download the example code files for this book from your account at www.packt.com. If you purchased this book elsewhere, you can visit www.packtpub.com/support and register to have the files emailed directly to you.
You can download the code files by following these steps:
- Log in or register at www.packt.com.
- Select the Support tab.
- Click on Code Downloads.
- Enter the name of the book in the Search box and follow the onscreen instructions.
Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:
- WinRAR/7-Zip for Windows
- Zipeg/iZip/UnRarX for Mac
- 7-Zip/PeaZip for Linux
The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/RabbitMQ-Essentials-Second-Edition. In case there's an update to the code, it will be updated on the existing GitHub repository.
We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!
Download the color images
We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://static.packt-cdn.com/downloads/9781789131666_ColorImages.pdf.
Conventions used
There are a number of text conventions used throughout this book.
CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "As it stands, neither the cc-admin nor cc-dev users have permission to do anything on cc-dev-vhost."
A block of code is set as follows:
connection = Bunny.new ENV['RABBITMQ_URI']
# Start a session with RabbitMQ
connection.start
Any command-line input or output is written as follows:
sudo apt install curl gnupg -y
sudo apt install apt-transport-https
Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "Click on the Admin tab of the console."
Get in touch
Feedback from our readers is always welcome.
General feedback: If you have questions about any aspect of this book, mention the book title in the subject of your message and email us at customercare@packtpub.com.
Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/support/errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.
Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at copyright@packt.com with a link to the material.
If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.
Reviews
Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!
For more information about Packt, please visit packt.com.
- Vue.js設計與實現
- 華為HMS生態與應用開發實戰
- Mastering ServiceNow(Second Edition)
- Mastering Linux Security and Hardening
- Scala for Machine Learning(Second Edition)
- TMS320LF240x芯片原理、設計及應用
- Getting Started with Polymer
- Python Deep Learning
- Python硬件編程實戰
- 程序員必會的40種算法
- Android應用程序設計
- Building Web and Mobile ArcGIS Server Applications with JavaScript(Second Edition)
- Learning Apache Thrift
- Odoo Development Essentials
- MEAN Blueprints