Messaging middleware --RabbitMQ (c) understand the core concepts and RabbitMQ AMQP protocol!

Seeking attention

Understand the core concepts and RabbitMQ AMQP protocol!

Foreword

This chapter learning, we can understand the following knowledge:

  • Why the Internet giant selection RabbitMQ?
  • How high-performance road RabbiMQ is done?
  • What is AMQP advanced protocols?
  • The core concept is what AMQP?
  • RabbitMQ overall architecture model look like?
  • RabbitMQ messaging is how circulation?

1. acquaintance RabbitMQ

RabbitMQ is an open source message broker and queue server, used between disparate applications through common protocol shared data (RabbitMQ mechanisms to achieve cross-language cross-platform,), RabbitMQ is using Erlang language to write, and RabbitMQ is based on AMQP protocol.

Through the above only one sentence, I believe we must have a lot of doubts and questions.

  • In the end how RabbitM maturity?
  • How about the industry's use of? Which manufacturers in use? why?
  • Including RabbitMQ in the end what are the characteristics?
  • RabbitMQ Why use Erlang language to write?
  • What is the AMQP protocol? What specific protocol AMQP specification is inside?

I believe everyone like me will have such doubts. Then we work together to learn a RabbitMQ it.

We come to understand the first question.

2. Why the Internet giant selection RabbitMQ?

How about the industry's use of? Which manufacturers in use? why? What are the advantages? As far as I know: drops, the US group, where to go, headlines ...

These manufacturers are using the Internet as a base component RabbitMQ its underlying message communication. root cause:

  1. Open source, outstanding performance, stability guarantee
  2. Provide reliable message delivery mode (confirm), return mode (return)
  3. And perfectly integrated SpringAMQP, scalability becomes stronger, rich API
  4. Rich cluster model, expressions configuration, the HA (High Availability) model, a queuing model mirroring
  5. Ensure data is not lost achieve high reliability under the premise of availability

How high-performance road 3. RabbiMQ is done?

The reason is that it uses the Erlang language, Erlang language original mode switch is in the field of architecture, which makes RabbitQ performance data exchange between the Broker is very good.

Another point also depends on authors, author RabbitMQ RabbitMQ developed between the development, first with Erlang language to a simple switch, and then he was surprised to find: the advantages of Erlang: Erlang and native Socket has as good a delayed effect. I believe we contact Socket friends, what kind of performance it's a certain understanding. Like RPC communication framework we are familiar with. For example: dubbo, it is to use a bottom Netty, Netty nothing more than network programming king of high performance , it is nothing more than a the Socket . Based on the characteristics of it, we have a full selection of RabbitMQ reason. In fact, we choose RabbitMQ, when there is a major objective consideration is this: When a message into the RabbtMQ node when RabbitMQ delay and response.

4. What is AMQP Advanced Message Queuing Protocol?

  • AMQP full name: Advanced Message Queuing Protocol (Advanced Message Queuing Protocol)

AMQP defined : a binary protocol modern features. Is a provider of unified messaging service application layer standard Advanced Message Queuing Protocol, it is an open standard application layer protocol for message-oriented middleware design.

It is similar to the Java JMS. Comparison of upper specification is based on this specification can develop a variety of messaging middleware.

AMQP protocol model

Model Analysis

Pubilsher application: application messages produced by the producer, threw Server side.

Server: refers to the node RabbitMQ

Virtual host: Web Hosting, a comparison of the top of the route, such a concept similar to the router. Subsequent introduction

Exchange: switch, directly to the producer of the message delivered to the Exchange. But to go through three processes - "server-> Virtual host-> Exchange

First determine which server to send a message, you need to go to establish a connection, set up some addresses, and so on. The second layer, which is delivered to the Virtual host needs to be defined. The third layer, which is delivered to the Exchange also need to be defined.

Look at the application side Consumer application of the consumer, the consumer side only need to monitor Message Queue, when there are messages in the queue, so they took out the consumer. So between the Exchange and Message Queue have a binding relationship exists, the follow-up details.

5. AMQP core concept is what?

AMQP core concepts:

  • server: Also known as Broker, the client receives a link, to achieve AMQP service entity
  • Connection: links, Broker application connects to the network
  • Channel: network channel, almost all of the operations (data read, write) are carried out in the Channel, Channel is the channel read and write messages. The client can create multiple Channel, Channel each task on behalf of a session.
  • Message: messages, data transfer between the server and the application by the Body Composition and Properties. Properties can be modified message, such as message priority, delay and other advanced features; Body is the message body.
  • Virtual host: virtual address, for performing logical isolation, the uppermost message routing. A Virtual host which may have several Exchange and Queue, the same can not have a Virtual Host inside and Exchange Queue same name. A logical concept, similar Redis logical database. Used to divide the specific service.
  • Exchange: switch, receiving a message, forwarding the message to the queue according to the routing key bindings
  • Binding: virtual connection between the Exchange and Queue, Binding can be included in routing key
  • Routing key: a routing shares, the virtual machine can use to determine how to route a particular message.
  • Queue: also known as message Queue, message queues, save messages and forward them to the consumer.

Above core concept to have a general understanding, the future will be described in detail.

6. RabbitMQ overall architecture model look like?

RabbitMQ logic chart
Producers message delivery to the Exchange, Exchange delivered to the Queue. So we just need to focus on producers to deliver the message to the specified Exchange to our consumers only need to listen to the specified Queue. It is that simple mechanism. We can see through the map, to which producers do not need to focus on the delivery queue, the consumer does not need to concern from which Exchange up, these two without coupling. Mainly the relationship between Exchange and Queue should have a binding.

7. RabbitMQ messaging is how circulation?

Message flow diagram

Producers publisher application to the production of delivered messages Message Exchange, Exchange binding MessageQueue, can bind through multiple MessageQueue, why the three queues only one queue received the news? Exchange is mainly due to a routing function. This route is a routing key, this route there are two very critical points, first: you need to send a message to which Exchange. Second: When you need to bring a message routing key, and then establish a binding relationship through the Exchange and MessageQueue, the route through the key routes the message to a specified queue. Then we end consumer directly monitor queue on the line, you can spend.

The end of the sentence

Welcome attention to personal micro-channel public number: Coder program for the latest original technical articles and free learning materials, a lot more boutique mind maps, interview data, PMP preparation materials waiting for you to lead, allowing you to learn technical knowledge anytime, anywhere! Create a qq group: 315 211 365, we welcome into the group exchange study together. Thank you! Can also be introduced to the side of a friend in need.

Articles included to Github: github.com/CoderMerlin... Gitee: gitee.com/573059382/c... welcome attention and star ~

Micro-channel public number

References:

"RabbitMQ messaging middleware technology succinctly"

recommended article:

Messaging middleware --RabbitMQ (a) Windws / Linux environment to build (full version)

Messaging middleware --RabbitMQ (two) major mainstream messaging middleware comprehensive comparison introduced!

Guess you like

Origin juejin.im/post/5d417ac3e51d4562112e39a2