Book Image

RabbitMQ Essentials - Second Edition

By : Lovisa Johansson, David Dossot
Book Image

RabbitMQ Essentials - Second Edition

By: Lovisa Johansson, David Dossot

Overview of this book

RabbitMQ is an open source message queuing software that acts as a message broker using the Advanced Message Queuing Protocol (AMQP). This book will help you to get to grips with RabbitMQ to build your own applications with a message queue architecture. You’ll learn from the experts from CloudAMQP as they share what they've learned while managing the largest fleet of RabbitMQ clusters in the world. Following the case study of Complete Car, you’ll discover how you can use RabbitMQ to provide exceptional customer service and user experience, and see how a message queue architecture makes it easy to upgrade the app and add features as the company grows. From implementing simple synchronous operations through to advanced message routing and tracking, you’ll explore how RabbitMQ streamlines scalable operations for fast distribution. This book will help you understand the advantages of message queue architecture, including application scalability, resource efficiency, and user reliability. Finally, you’ll learn best practices for working with RabbitMQ and be able to use this book as a reference guide for your future app development projects. By the end of this book, you’ll have learned how to use message queuing software to streamline the development of your distributed and scalable applications.
Table of Contents (8 chapters)

Reply-to queues and RPC

The CC application can now communicate in a good way between the publisher and the consumer, but what if a function has to run on a remote computer and wait for the result? Hardcoding an exchange and routing key in the service to publish responses isn't possible as it would be too inflexible. The solution is to have the request message carry the coordinates of the location where the response should be sent, a pattern commonly known as RPC.

The application service calls a specific function residing on the taxi application, and the taxi sends the result to the end user. The request message carries the name of the queue where the response should be sent. The AMQP protocol supports this mechanism out of the box. The client can store the queue name of the location where the response must be sent.

When RabbitMQ delivers a message to the consumer, it will change the reply-to property. The server can reply to the message from the publisher by sending a message to...