How can queues be made private/secure in RabbitMQ in a multitenancy system?

TLDR: The relevant information can be found here: https://www.rabbitmq.com/access-control.html. However, since the rabbitmq documentation is very verbose, below I will describe what seems like the only solution to locking down access to resources. Summary Virtual hosts As Michael Dillon mentions, you should start by making everything happen inside vhosts (virtual hosts) and block the generic … Read more

How does RabbitMQ actually store the message physically?

RabbitMQ uses a custom DB to store the messages, the db is usually located here: /var/lib/rabbitmq/mnesia/rabbit@hostname/queues Starting form the version 3.5.5 RabbitMQ introduced the new New Credit Flow https://www.rabbitmq.com/blog/2015/10/06/new-credit-flow-settings-on-rabbitmq-3-5-5/ Let’s take a look at how RabbitMQ queues store messages. When a message enters the queue, the queue needs to determine if the message should be … Read more

What does MassTransit add to RabbitMQ?

Things that MT adds on top of just using RabbitMQ: Optimized, asynchronous multithreaded, concurrent consumers Message serialization, with support for interfaces, classes, and records, including guidance on versioning message contracts Automatic exchange bindings, publish conventions Saga state machines, including persistent state via Entity Framework Core, MongoDB, Redis, etc. Built-in metrics, Open Telemetry, Prometheus Message headers … Read more

Why do my RabbitMQ channels keep closing?

An AMQP channel is closed on a channel error. Two common things that can cause a channel error: Trying to publish a message to an exchange that doesn’t exist Trying to publish a message with the immediate flag set that doesn’t have a queue with an active consumer set I would look into setting up … Read more

Consume multiple queues in python / pika

One possible solution is to use non blocking connection and consume messages. import pika def callback(channel, method, properties, body): print(body) channel.basic_ack(delivery_tag=method.delivery_tag) def on_open(connection): connection.channel(on_open_callback=on_channel_open) def on_channel_open(channel): channel.basic_consume(queue=”queue1″, on_message_callback=callback) channel.basic_consume(queue=”queue2″, on_message_callback=callback) parameters = pika.URLParameters(‘amqp://guest:guest@localhost:5672/%2F’) connection = pika.SelectConnection(parameters=parameters, on_open_callback=on_open) try: connection.ioloop.start() except KeyboardInterrupt: connection.close() This will connect to multiple queues and will consume messages accordingly.

How to requeue messages in RabbitMQ

Short answer: To requeue specific message you can pick both basic.reject or basic.nack with multiple flag set to false. basic.consume calling may also results to messages redelivering if you are using message acknowledge and there are un-acknowledged message on consumer at specific time and consumer exit without ack-ing them. basic.recover will redeliver all un-acked messages … Read more