concept addition in category rabbitmq

appears as: ddition
RabbitMQ in Depth

This is an excerpt from Manning's book RabbitMQ in Depth.

Vagrant is an automation tool for managing virtual environments. It allows for VMs to be provisioned from scratch, providing a structure for downloading and installing a base VM image, and it integrates with configuration management tools like Chef and Puppet. The result is a consistently deployed VM that makes for a solid development environment. In addition, because it’s run on your local machine, it maps network access to the services running in the VM to your local computer’s localhost network interface. This functionally makes it appear as if RabbitMQ and the other network-based tools you’ll be using in this book are running natively on your computer instead of in a VM.

When your messaging architecture calls for RPC behavior between your publishers and consumers, if you use STOMP there is convenient behavior built into the RabbitMQ STOMP plugin. By setting the reply-to header when you send a message via STOMP, the reply queue will automatically be created, setting both the exclusive and auto-delete flags on the queue so that the publishing STOMP connection is the only connection that can consume messages from the reply queue. In addition, the reply queue will automatically be deleted from RabbitMQ should your publishing application be disconnected.

The Python stomp.py library requires a ConnectionListener object to process messages received from a message broker. This object should contain an on_message method that will be invoked whenever the subscriber receives a message. In this example, you’ll print out headers if there are any, and the message. In addition, you only want to receive one message and then quit. In the demo listener, you’ll add a flag named can_stop that will let the example know when to stop.