有没有办法使用 java 客户端从 Amqp 0.9.1 RabbitMq 代理将所有 headers 绑定到 queue?
Is there a way to get all headers bound to a queue from an Amqp 0.9.1 RabbitMq broker using the java client?
在 AMQP 版本 0.9.1 中使用 com.rabbitmq.client 我正在执行以下操作来声明一个持久的 headers 交换,声明一个持久的 queue,并绑定 queue 与 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);
如果我再次 运行 相同的代码,但使用不同的 header name/value 我实际上是在 queue 上添加了另一个 header经纪人(不取代前一个)。
即
...
bindingArgs.put("headerName2", "headerValue2");
...
java rabbitmq 客户端是否有办法从代理获取 queue 的所有绑定 header?
这会 return 类似于:
"headerName1" : "headerValue1"
"headerName2" : "headerValue2"
此问题与
重复
List bindings for an exchange with rabbitmq java client API。
虽然此功能似乎不在 java 客户端中,但可以通过代理上的命令行查看绑定(包括 header 参数)。
rabbitmqctl list_bindings
有关更多选项,请参阅 RabbitMQ 文档
https://www.rabbitmq.com/rabbitmqctl.8.html#list_bindings
在 AMQP 版本 0.9.1 中使用 com.rabbitmq.client 我正在执行以下操作来声明一个持久的 headers 交换,声明一个持久的 queue,并绑定 queue 与 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);
如果我再次 运行 相同的代码,但使用不同的 header name/value 我实际上是在 queue 上添加了另一个 header经纪人(不取代前一个)。
即
...
bindingArgs.put("headerName2", "headerValue2");
...
java rabbitmq 客户端是否有办法从代理获取 queue 的所有绑定 header?
这会 return 类似于:
"headerName1" : "headerValue1"
"headerName2" : "headerValue2"
此问题与
重复List bindings for an exchange with rabbitmq java client API。
虽然此功能似乎不在 java 客户端中,但可以通过代理上的命令行查看绑定(包括 header 参数)。
rabbitmqctl list_bindings
有关更多选项,请参阅 RabbitMQ 文档 https://www.rabbitmq.com/rabbitmqctl.8.html#list_bindings