Skip to content

Instantly share code, notes, and snippets.

View MarcialRosales's full-sized avatar

Marcial Rosales MarcialRosales

View GitHub Profile
@MarcialRosales
MarcialRosales / README.md
Last active September 20, 2019 16:11
RabbitMQ Queue Distribution Strategies

RabbitMQ Queue Distribution Strategies

Queues can be distributed between nodes by either

  • expliciting declaring the queues in the node where we want it to go,
  • or delegating to RabbitMQ to evenly distributed the queue for us

These two options are fully explained in the rabbitmq docs.

However it is important to understand that when nodes are restarted, say during a rolling upgrade, we may end up with an unbalanced cluster. RabbitMQ will NOT automatically move queues in an attempt to obtain a balanced cluster.

@MarcialRosales
MarcialRosales / README.md
Last active January 5, 2024 06:37
Managing policies in RabbitMQ for PCF

Managing policies in RabbitMQ for PCF

This is a quick guide on how to manage RabbitMQ policies in RabbitMQ for PCF. We can make it extensible for any RabbitMQ, not necessarily for PCF, but the example and sample scripts provided in this guide are meant for PCF.

Prefer Policies over x-args

It is highly recommended that we do not pass any arguments (a.k.a x-args) when we declare AMQP queues or exchanges. Although the AMQP protocol allows us, it will not allow us to change those arguments afterwards. Say we declare a queue with a TTL of 60sec. Later on we decide that 60sec was too tight and we want it to be 90sec. Our application will fail to declare the queue with the new setting. There several ways to remedy this situation or on the other hand avoid it entirely.

To remedy the situation we would have to:

  • delete the entire if we dont care about losing the messages and let the application declare it again with the new settings
@MarcialRosales
MarcialRosales / Readme.md
Last active July 19, 2018 15:54
Gather consumer channel information from RabbitMQ in order to troubleshoot an issue with unexpected unacknowledged messages

Instructions

  1. Copy the provided script (gatherChannelInfo.erl) onto one of the rabbitmq vms
    e.g.
bosh -d <yourDeploymentName> scp gatherChannelInfo.erl rmq/b9b26ca8-6a15-4bf6-9881-68486042f46b:/tmp/gatherChannelInfo.erl
  1. Ssh onto the same rabbitmq vms and switch to root (sudo -i)