What is RabbitMQ?

Exchange Type

The exchange parameter is the name of the exchange. The empty string denotes the default or nameless exchange: messages are routed to the queue with the name specified by routing_key, if it exists.

Topic can achieve fanout and direct

  • fanout : Broadcasts all the messages it receives to all the queues it knows

  • direct : Binding Exchange Name=Routing Key

  • topic : All matching routing key queue will accept

Efficiency: fanout > direct > topic

如果Binding中的Routing key為# 或者 #.#, 則全部轉發,類似Fanout Exchange 如果指定了Exchange是Topic類型的,但是相應的Binding中的Routing key *,#都沒有,則相等才轉發,類似於Direct Exchange

Last updated

Was this helpful?