0

Using com.rabbitmq.client with AMQP version 0.9.1 I am doing the following to declare a durable headers exchange, declare a durable queue, and bind the queue to the exchange with headers.

channel.exchangeDeclare("myExchange", "headers", true);
channel.queueDeclare("myQueue", true, false, false, null);

Map<String, Object> bindingArgs = new HashMap<String, Object>();
bindingArgs.put("x-match", "any"); //any or all
bindingArgs.put("headerName1", "headerValue1");

channel.queueBind("myQueue", "myExchange", "", bindingArgs);

If I run the same code again, but with a different header name/value I am effectively adding another header to the queue on the broker (not replacing the previous one).

i.e.

...
bindingArgs.put("headerName2", "headerValue2");
...

Is there a way with the java rabbitmq client to get all of the bound headers for a queue from the broker?

This would return something like:

"headerName1" : "headerValue1"
"headerName2" : "headerValue2"

1 Answers1

0

This question is a duplicate of

List bindings for an exchange with rabbitmq java client API.

While this functionality doesn't appear to be in the java client, it is possible to view bindings (including header arguments) via command line on the broker.

rabbitmqctl list_bindings

See the RabbitMQ documentation for more options https://www.rabbitmq.com/rabbitmqctl.8.html#list_bindings