RabbitMQ 01 Overview

What is message queue

When making a large number of remote calls, the traditional HTTP method is easy to cause blocking, so the concept of message queue is introduced , that is, queuing messages and consuming them according to the queue.

It can put the information sent by the sender into the queue. When a new message is added to the queue, the receiver will be notified for processing. Generally, the message sender is called the producer and the receiver is called the consumer .

In this way, all requests can be thrown into the message queue and then taken out by the consumer. Instead of directly connecting to the consumer, a middleware is added, which is a good decoupling solution. And in the case of high concurrency, due to the limited consumer capabilities, the message queue can also play a role in peak-shaving and valley-filling , accumulating a part of the requests, and then the consumers will slowly process them, instead of making requests like direct calls. swarms of people.

message queue component

ActiveMQ, RabbitMQ, RocketMQ, and Kafka are currently the mainstream message queue components. Their characteristics are as follows:

Based on the above factors, RabbitMQ is chosen as the message queue component for demonstration. Here’s why:

  • Although the throughput is not high, it is completely sufficient for small and medium-sized projects.
  • Strong timeliness. Latency reaches a subtle level, the lowest latency compared to similar products.
  • High usability. Provides a complete high-availability implementation mechanism.
  • Strong reliability. Basically no packet loss.
  • Strong concurrency capabilities. Developed based on Erlang, it provides rich switch functions with good performance and low latency.
  • Open source and free. There is no usage cost, the community is highly active, and the product is stable.

The functions and implementation of message queue components are similar. If you learn one component well, you can get everything. There are also message queue connection components such as Spring Cloud Stream, which can shield the differences between message queue components and use unified standards. Call the message queue component.

Therefore, if you want to master the message queue, starting with RabbitMQ is a better choice.

RabbitMQ

Official website: https://www.rabbitmq.com

RabbitMQ is an open source message broker software (also known as message-oriented middleware) that implements the Advanced Message Queuing Protocol ( AMQP ). The RabbitMQ server is written in the Erlang language, while clustering and failover are built on the Open Telecommunications Platform framework. All major programming languages ​​have client libraries that communicate with proxy interfaces.

Rabbit Technologies Ltd. develops and provides support for RabbitMQ.

  • Initially, Rabbit Technology was a joint venture established in 2007 between LSHIFT and CohesiveFT.
  • In April 2010, it was acquired by SpringSource, a subsidiary of VMware.
  • RabbitMQ became part of GoPivotal in May 2013.

Its characteristics are as follows:

  • With tens of thousands of users, RabbitMQ is one of the most popular open source message queues, used globally by small startups and large enterprises, from T-Mobile to Runtastic.
  • Lightweight and easy to deploy on-premises and in the cloud, it supports multiple messaging protocols.
  • Can be deployed in distributed and federated configurations to meet large-scale, high-availability requirements.
  • Runs on many operating systems and cloud environments, and provides a wide range of developer tools for most popular languages .

working process:

  • Producer (Publisher) : The terminal that produces messages.
  • Channel : Both the server and client connections use a Channel, and then use the Channel to access the RabbitMQ server. The communication protocol here is not http, but amqp protocol.
  • Virtual Host : Similar to environment isolation, a Virtual Host can be configured separately in different environments. Each Virtual Host can contain many Exchanges and Queues, and each Virtual Host does not affect each other.
  • Exchange : According to the request, it is forwarded to the corresponding message queue. Each queue can be bound to Exchange, so that Exchange can forward data to the queue. There can be many, and different Exchange types can be used for implementation. Patterns of different messages.
  • Message Queue (Queue) : The message queue itself. All messages from producers are stored in the message queue, waiting for consumers to take them out.
  • Consumer : Terminal that consumes messages.

Guess you like

Origin blog.csdn.net/qq_37770674/article/details/130436842