- Hands-On Microservices with C#
- Matt R. Cole
- 239字
- 2021-07-23 17:25:23
Direct exchange
A direct exchange delivers messages to queues based on a message routing key. The routing key can be seen as an address that the exchange is using to decide how to route the message. A message goes to the queues whose binding key exactly matches the routing key of the message.
The direct exchange type is useful when you would like to distinguish messages published to the same exchange using a simple string identifier.
Imagine that Queue A (create_pdf_queue) in the following diagram is bound to a direct exchange (pdf_events) with the binding key pdf_create. When a new message with the routing key pdf_create arrives at the direct exchange, the exchange routes it to the queue where the binding_key = routing_key is, in this case, to Queue A (create_pdf_queue).
SCENARIO 1:
- Exchange: pdf_events
- Queue A: create_pdf_queue
- Binding a key between exchange (pdf_events) and Queue A (create_pdf_queue): pdf_create
SCENARIO 2:
- Exchange: pdf_events
- Queue B: pdf_log_queue
- Binding a key between exchange (pdf_events) and Queue B (pdf_log_queue): pdf_log
EXAMPLE:
A message with the routing key pdf_logis sent to the exchange pdf_events. The message is routed to pdf_log_queue because the routing key (pdf_log) matches the binding key (pdf_log). If the message routing key does not match any binding key, the message will be discarded, as seen in the direct exchange diagram:

A message goes to the queues whose binding key exactly matches the routing key of the message.
- Instant Raspberry Pi Gaming
- 計算機應用
- Excel 2007函數與公式自學寶典
- Getting Started with MariaDB
- Windows 8應用開發實戰
- AutoCAD 2012中文版繪圖設計高手速成
- CompTIA Linux+ Certification Guide
- Kubernetes for Serverless Applications
- Spark大數據商業實戰三部曲:內核解密|商業案例|性能調優
- MongoDB 4 Quick Start Guide
- 機器人制作入門(第4版)
- Advanced Deep Learning with Keras
- Generative Adversarial Networks Projects
- Containerization with Ansible 2
- 從實踐中學嵌入式Linux操作系統