Search code examples
phprabbitmqamqpphp-amqplib

RabbitMQ and php-amqplib - how to get bindings (routing keys) for an exchange?


I'm using php-amqplib library for RabbitMQ publishing/consuming messages.

I did some research, but did not found a way to list all the routing keys (bindings) that are assigned to an RabbiMQ exchange.

The management API has a possibility to list the bindings, but I prefer the PHP way.

How to get the bindings (routing keys) for an RabbitMQ exchange with php-amqplib?


Solution

  • Unfortunately, till now, the only easy way to get all bindings is using the Rabbit management API:

    https://{messageBroker}:15671/api/exchanges/{vhost}/{exchangeName}/bindings/source

    Original docs:

    https://www.rabbitmq.com/management.html

    https://cdn.rawgit.com/rabbitmq/rabbitmq-management/v3.7.4/priv/www/api/index.html