我想使用路由密钥为“”的自动删除匿名队列,使用Camel的RabbitMQ组件绑定到持久交换 . 当我像这样设置 endpoints 时(为了可读性而重新格式化):
rabbitmq://localhost:6672/br.processor?
autoAck=true&
autoDelete=false&
bridgeEndpoint=true&
concurrentConsumers=1&
durable=true&
exchangeType=topic&
prefetchCount=2000&
prefetchEnabled=true&
queue=&
routingKey=&
username=xxxx&
password=xxxxxx&
vhost=xxxx
我收到一个匿名命名的持久队列,绑定到正确的交换,路由密钥设置为队列的名称 .
我查看了代码(2.14.2),看起来队列将始终具有与其交换相同的持久性,但是当路由密钥未指定时( null
),路由密钥将仅设置为空字符串 . 当我尝试这样做时,路由键仍然设置为队列的名称 . 当我指定路由密钥时,我确实得到了预期的路由密钥 .
环顾这里和其他地方,我找到了Avoid automatic binding with RabbitMQ and Camel,但没有声明交换和队列导致问题 .
是否可以使用Camel使用空白路由键绑定队列?
1 回答
使用扇出交换机不需要路由密钥