当前位置:网站首页>MQ tutorial | exchange (switch)
MQ tutorial | exchange (switch)
2022-07-02 14:27:00 【It's not the Eight Precepts of the second senior brother】
Exchange
Producer Send the message to Exchange , from Exchange Route messages to one or more Queue in ( Or throw away ).Exchange according to Routing Key and Binding Key Route messages to Queue. Different types of Exchange Different routing rules . Message queue AMQP Version currently supports three types Exchange:
- Direct Exchange
- Topic Exchange
- Fanout Exchange
Direct Exchange
- The routing mode is based on Binding Key = Routing Key Rules for routing messages .
- Use scenarios to distinguish the same Exchange The news of .
- figure 1. Direct Exchange
Direct Exchange Respectively with Queue A and Queue B binding .Consumer It can be downloaded from Queue A Pull all pictures from (img) establish (create) news , from Queue B Pull all pictures from (img) journal (log) news .
- Direct Exchange binding Queue:
- Direct Exchange and Queue A Of Binding Key by img.create.
- Direct Exchange and Queue B Of Binding Key by img.log.
- Producer towards Direct Exchange Send a message :
- news A Of Routing Key by img.create.
- news B Of Routing Key by img.log.
- Direct Exchange according to Binding Key = Routing Key Rules for routing messages :
- Routing Key by img.create The news of A Route to Binding Key by img.create Of Queue A.
- Routing Key by img.log The news of B Route to Binding Key by img.log Of Queue B.
Topic Exchange
- Routing rules match routing messages according to wildcards .
- asterisk (*) Represents a word ( for example :cn).
- Well No (#) For zero 、 One or more words , Between words through English full stop (.) Separate ( for example :cn.zj.hz).
- Use scenarios through Topic Distinguish between messages .
- figure 2. Topic Exchange
Topic Exchange Respectively with Queue A and Queue B binding .Consumer It can be downloaded from Queue A China pulls all China (cn) Hangzhou (hz) The file of (files), from Queue B China pulls all China (cn) The store (store) The file of (files).
- Topic Exchange binding Queue:
- Topic Exchange and Queue A Of Binding Key by files.cn.hz.#.
- Topic Exchange and Queue B Of Binding Key by files.cn.*.store.
- Producer towards Topic Exchange Send a message :
- news A Of Routing Key by files.cn.hz.
- news B Of Routing Key by files.cn.hz.store.
- news C Of Routing Key by files.cn.sz.store.
- Topic Exchange Route messages according to wildcard matching rules :
- Routing Key by files.cn.hz The news of A Route to Binding Key by files.cn.hz.# Of Queue A.
- Routing Key by files.cn.hz.store The news of B Route to Binding Key by files.cn.hz.# Of Queue A and Binding Key by files.cn.*.store Of Queue B.
- Routing Key by files.cn.sz.store The news of C Route to Binding Key by files.cn.*.store Of Queue B.
Fanout Exchange
- Routing rules Fanout Exchange ignore Routing Key and Binding Key Matching rules of , Post the message to all bound Queue.
- Use scenarios to broadcast messages .
- figure 3. Fanout Exchange
Fanout Exchange Post the message to all bound Queue,Consumer From all Queue Pull the same message .
- Fanout Exchange binding Queue:Fanout Exchange and Queue A、Queue B、Queue C Of Binding Key Can be any value .
- Producer towards Fanout Exchange Send a message : news A Of Routing Key It can be any value .
- Fanout Exchange Route messages to all bound Queue:Routing Key Messages with arbitrary values A Route to Binding Key For any value Queue A、Queue B、Queue C.
Reprint : MQ course | Exchange( Switch ) Introduce ( 6、 ... and )
边栏推荐
- 【虹科技术分享】如何测试 DNS 服务器:DNS 性能和响应时间测试
- [Hongke technology sharing] how to test DNS server: DNS performance and response time test
- selenium 元素定位方法
- Pychart connects to the remote server
- Use of freemaker
- Systemserver process
- 《可供方案开发》口算训练机/数学宝/儿童口算宝/智能数学宝 LCD液晶显示驱动IC-VK1622(LQFP64封装),原厂技术支持
- Fabric.js 缩放画布
- [development environment] StarUML tool (download software | StarUML installation | StarUML creation project)
- Story point vs. Human Sky
猜你喜欢
Available solution development oral arithmetic training machine / math treasure / children's oral arithmetic treasure / intelligent math treasure LCD LCD driver ic-vk1622 (lqfp64 package), original te
Tip: SQL Server blocked the state 'openrowset/opendatasource' of component 'ad hoc distributed queries'
PyQt5_QScrollArea内容保存成图片
提示:SQL Server 阻止了对组件‘Ad Hoc Distributed Queries ‘的STATEMENT ‘OpenRowset/OpenDatasource“”
Codeforces Round #803 (Div. 2)(A~D)
Default slot, named slot, scope slot
< schematic diagram of oral arithmetic exercise machine program development> oral arithmetic exercise machine / oral arithmetic treasure / children's math treasure / children's calculator LCD LCD driv
QT new project
Chinese science and technology from the Winter Olympics (III): the awakening and evolution of digital people
测试框架TestNG的使用(二):testNG xml的使用
随机推荐
Design and implementation of car query system based on php+mysql
Chinese science and technology from the Winter Olympics (III): the awakening and evolution of digital people
故事点 vs. 人天
Codeforces Round #803 (Div. 2)(A~D)
Codeforces Round #803 (Div. 2)(A~D)
Analysis of CPU surge in production environment service
Pychart connects to the remote server
Tip: SQL Server blocked the state 'openrowset/opendatasource' of component 'ad hoc distributed queries'
P1042 [NOIP2003 普及组] 乒乓球
STM32-DAC实验&高频DAC输出测试
Daily learning 3
uniapp自动化测试学习
NLA自然语言分析,让数据分析更智能
线性dp求解 最长子序列 —— 小题三则
Fabric.js 缩放画布
【虹科技术分享】如何测试 DNS 服务器:DNS 性能和响应时间测试
In 2021, the global styrene butadiene styrene (SBS) revenue was about $3722.7 million, and it is expected to reach $5679.6 million in 2028
什么是 eRDMA?丨科普漫画图解
<口算練習機 方案開發原理圖>口算練習機/口算寶/兒童數學寶/兒童計算器 LCD液晶顯示驅動IC-VK1621B,提供技術支持
路由(二)