当前位置:网站首页>Talk about message oriented middleware (1) and AMQP
Talk about message oriented middleware (1) and AMQP
2022-06-10 17:32:00 【pythonxxoo】
High quality resource sharing
| Learning route guidance ( Click unlock ) | Knowledge orientation | Crowd positioning |
|---|---|---|
| 🧡 Python Actual wechat ordering applet 🧡 | Progressive class | This course is python flask+ Perfect combination of wechat applet , From the deployment of Tencent to the launch of the project , Create a full stack ordering system . |
| Python Quantitative trading practice | beginner | Take you hand in hand to create an easy to expand 、 More secure 、 More efficient quantitative trading system |
The opening
When it comes to message queuing , I believe you are not new . In fact, everyone has used it in their daily work . It is believed that most of the R & D is just staying in the process of using message queues , The knowledge points inside are not very systematic , Some powerful functions may not be accessible due to the business form or business level of the company . That's what old cats do at work , What is used MQ All are encapsulated by architects , Simply call . In order to better understand why , So the old cat took the time to sort it out MQ A series of knowledge points , It is said that “ Bad writing is better than good memory ”, So the old cat recorded it in the process of learning . Share it with friends in need , Of course, it is also convenient for you to consult later , So there is this series of articles .
AMQP Protocol Brief
Many of you have come into contact with RabbitMq, Actually RabbitMq Namely AMQP An implementation of the protocol .
Rather than AMQP It's a protocol , In fact, it is a standard . Is an open standard for application layer protocols , Designed for message-oriented middleware .AMQP It's a network protocol that delivers asynchronous messages between processes . Its full name is AMQP(Advanced Message Queuing Protocol). The client and message middleware based on this protocol can deliver messages , Not by the client / Different middleware products , Restrictions on different development languages and other conditions .AMQP The main feature is message oriented 、 queue 、 route ( Including point-to-point and release / subscribe )、 reliability 、 Security .AMQP The behavior of the message provider and the client is mandatory , This enables different vendors to truly realize interoperability .
About Kafka and AMQP Add a separate point
I believe that in our daily work, in addition to RabbitMQ Besides, many friends have used it kafka Well , that kafka and AMQP What does it matter ?
The answer is : No problem .
Kafka Not a message queue at all . Officially ,Kafka It's a streaming platform (stream processing platform).Kafka It was designed to support high throughput log processing , It just happens to be able to implement most of the functions of message queuing .Kafka Used “ Black science and technology ”( For example, zero copy / Memory mapping , And right page cache The use of , Of course, these follow-up sharing kafka And then synchronize with the little buddy when you get there ) They are out of the scope of the standard message queue design , So we can't simply think of Kafka Than RabbitMQ Etc AMQP Better message queuing for . for example ,RabbitMQ Support dead letter queue 、 Delay queue 、 Priority queue 、 multi-tenancy 、 Push mode consumption, etc ,Kafka They don't support .
AMQP and JMS The difference between
Speaking of AMQP agreement , You have to talk JMS. JMS It is an attempt to standardize the early message oriented middleware , It's just API Level has been standardized . Only applicable to Java The message oriented middleware specification of the platform , Support Java Message exchange between applications . And by providing standard production 、 send out 、 The interface to receive messages simplifies the development of enterprise applications . If you want to know more about JMS In fact, Baidu Encyclopedia has a very detailed explanation . The specific links :https://baike.baidu.com/item/JMS/2836691?fr=aladdin,
In addition, if a small partner wants its specific interface document , You can download here :https://download.oracle.com/otndocs/jcp/7195-jms-1.1-fr-spec-oth-JSpec/
JMS A brief summary
JMS It mainly includes two models ,(1) Point to point model (2) Publish and subscribe model

Point to point : The producer sends a message to the queue. Only one listener can get the message .
Publish subscribe : The producer delivers a message to the queue , All subscribers listening to the queue can get the message .
JMS Five different message body formats
JMS Five different message body formats are defined , And the type of message called , Allows you to send and receive data in different forms , Provides some level of compatibility with existing message formats .
- StreamMessage – Java Data flow of original value
- MapMessage– A set of names - It's worth it
- TextMessage– A string object
- ObjectMessage– A serialized Java object
- BytesMessage– One byte data flow
AMQP Model generalization
AMQP Model as follows 
- Server: also called Broker, Accept client connections , Realization AMQP Physical services .
- Connection: Connect , Application and Broker The Internet connection .
- Channel: Network channel . Almost all operations are in Channel In the middle of ,Channel It's a channel for reading and writing messages . The client can create multiple Channel, Every Channel Represents a conversational task .
- Message: news , Data transferred between the server and the application , from Properties and body form ,Properties You can decorate the message , For example, the priority of a message 、 Advanced features like delay ;Body Is the message body .
- Virtual host: Virtual address , Due to logical isolation , Top level message routing . One Virtual Host There can be several Exchange and Queue, The same Virtual Host It can't have the same name Exchange or Queue.
- Exchange: Switch , receive messages , Forward the message to the bound queue according to the routing key .
- Binding:Exchange and Queue Virtual connection between ,binding Can contain routing Key.
- Routing Key: A routing rule , Virtual machines can use it to determine how to route a particular message .
- Queue: Also known as Message Queue, Message queue , Save messages and forward them to consumers .
AMQP and JMS contrast
The above has made some simple generalizations , If you feel that you are lacking , Not too complete , Then you can consult relevant information by yourself .
| Contrast direction | JMS | AMQP |
|---|---|---|
| Definition | Java API | agreement |
| Cross language | no | yes |
| Cross platform | no | yes |
| Contrast the model | ①Peer-2-Peer( Point to point );②Pub/sub( Publish subscribe ) | ①direct exchange;②fanout exchange;③topic change;④headers exchange;⑤system exchange. In essence , The last four and JMS Of pub/sub The model doesn't make much difference , Only in the routing mechanism to do a more detailed division ;( This follow-up old cat will share with you rabbitMq I'll talk about it in detail ) |
| Message type | Support multiple message types , We mentioned above | byte[]( Binary system ) |
At the end
About AMQP This is the brief introduction of the agreement . If you feel that there is not enough detail, of course, you can spontaneously look for more information . The old cat in the back will focus on sorting RabbitMq as well as Kafka And share with you . Looking forward to your continued attention .
边栏推荐
- Daily question -1287 Elements that appear more than 25% in an ordered array
- Xinsi technology helps Israel visuality systems promote the "left shift" of security
- 2022G1工业锅炉司炉考题及在线模拟考试
- 海外数据中心需要为不可预测的灾难做好准备
- Swift 3pThread tool Promise Pipeline Master/Slave Serial Thread confinement Serial queue
- Facebook AI | 从数百万预测结构中学习逆向折叠
- Fabric.js 居中元素 ️
- What should be done to improve the service level of the park and optimize the business environment
- 运筹说 第64期丨动态规划奠基人——理查德·贝尔曼
- AIChE | ab initio drug design framework integrating mathematical programming method and deep learning model
猜你喜欢
随机推荐
力扣 20. 有效的括号
【玩转华为云】鲲鹏DevKit迁移实战
Importerror: libgl. so. 1: cannot open shared object file: no such file or directory
Fabric.js 精简输出的JSON
Fabric.js 激活输入框
Eliminate if Five ways of else
新思科技在《 2022 年 Gartner 应用安全测试关键能力报告》中表现优异 在五个常见用例中荣获最高分
Fail fast and fail safe
Web3 is the most complete money making secret script. Just read this one
运筹说 第64期丨动态规划奠基人——理查德·贝尔曼
Simple site backup shell script
Lifeifei: I am more like a scientist in physics than an engineer
Flood control and drainage monitoring automatic monitoring and telemetering terminal for flood control and drainage
提升园区服务水平,优化营商环境该从哪些方面入手
【内容共创】第17期 夏日炎炎,有你超甜!参与签约华为云小编,花样礼包总有一款打动你!
Installing kubernetes using kuboardspray (v1.23.1)
Nat. Commun. | Knowledge integration and decision support for accelerating the discovery of antibiotic resistance genes
A few misunderstandings about programmers are very harmful!
ADB is not an internal or external command, nor is it a runnable program or batch file
PrimeKG : 构建知识图谱以实现精确医疗









