RabbitMQ 主题绑定,它们有优先级吗?

RabbitMQ topic binding, do they have a priority?

RabbitMQ Fifth Tutorial 中(对于 Ruby,但它们对所有语言都相同),他们提到:

We created three bindings: Q1 is bound with binding key "*.orange.*" and Q2 with "*.*.rabbit" and "lazy.#"

然后:

"lazy.pink.rabbit" will be delivered to the second queue only once, even though it matches two bindings.

这怎么可能?据我所知,如果路由键匹配 45 个队列,它将转到所有 45 个队列。为什么这里不是这种情况?

Q2 有两个绑定,都将匹配单个消息。根据 AMQP 0.9.1 specification, section 1.7.2.3. Method queue.bind(第 35 页):

A server MUST not deliver the same message more than once to a queue, even if the queue has multiple bindings that match the message.

Test scenario:

A client declares a named queue and binds it using multiple bindings to the amq.topic exchange. The client then publishes a message that matches all its bindings.

所以当 lazy.pink.rabbit 路由键同时匹配 *.*.rabbitlazy.# 路由键时,消息不会被复制到 Q2 并且只有该消息的一个副本将居住在 Q2.

P.S.:

有很好的 Compatibility and Conformance RabbitMQ 文档页面,其中包含一个地方的所有规范。