About MQ message queue

  Project to use RabbitMQ, leading me to find out. Prior to the company, used before the message queue MQ, Ali that paragraph RocketMQ, when the company also made simple technology sharing, and he read some blog. Himself in the proper way cloud notes, do some finishing, but later it was put in the. Time is, on some simple concepts MQ to do the next finishing it.

  Some introductory RabbitMQ, refer https://www.jianshu.com/p/e55e971aebd8 , which explain some of the concepts and use is still very detailed.

What is the message queue - Definition

  We look at the Wikipedia definition above:

  It is an inter-process communication or communication between different threads of the same process, the software storage software for processing a series of input column, typically from a user.

  Message Queuing provides asynchronous communication protocol, each record comprises a data storage column detailed description, including the occurrence time, the type of input device, and a specific input parameters.

  In other words: the sender and recipient of the message does not need to simultaneously interact with the message queue. Messages are stored in the queue, you know the recipient retrieves it.

Here is the architecture diagram :

Producer: news producer, responsible for the production and sending a message to Broker;

Broker: a message processing center, responsible for storing the message, acknowledgment, retries and the like;

Consumer: Consumer news center, responsible for obtaining and processing information from the Broker.

Message Queue - Characteristics

  Induction of: the synchronous time-consuming task asynchronously by sending messages, reduce latency.

  Loosely Coupled: different systems, the service between the communication may be performed through the message queue, the implementation details do not care about each other, consistent with the data format.

  Distributed: In order to prevent clogging of the message, the cluster may be made to the consumer scale, single point of failure, the queue itself may be the same.

  Reliability: the received message off the disc, even after a reboot or a server failure, the recovery can be reloaded.

Scenarios - Quick description

  The characteristics of the application scenario may be simply described as:

    In dealing with high concurrency, and do not need to get immediate results.

  Common message queue are:

    RabbitMQ, RocketMQ, ActiveMQ, Kafka and so on. Redis MySQL database or message queue mode can also be implemented. Redis achieved before the message queue mode can refer to a description Redis essay

Scenarios - asynchronous processing    

 Scenarios - decoupling applications

 Scenarios - limiting clipping

  Scenarios - Log Processing

 Message mode Introduction - Introduction

1, point to point mode: REQ / REP

  The most basic model, the producer sends a message, the consumer removes and consumer information, given the response will be deleted from the message queue, it can not be repeated transmission, can only be consumed by a consumer.

 2, publish / subscribe model: Pub / Sub

  Very common and very useful as a model, the publisher and the subscriber decoupling. The publisher is only responsible for production data, without the need to care who are subscribers, the number of subscribers. Analogous to the micro-channel public number.

 3, the push / pull mode: Push / Pull

  It is a more important model, either Push or Pull end server end can do, to bind to specific addresses to wait for the other party access.

  If we bind address Push end, then this is a PushServer, corresponding PullClient can link to this PushServer pull the data; on the contrary, if the establishment of a PullServer, corresponding PushClient can link to PullServer pressure and entered data.

4, the route / mode Agent: Router / Dealer

  Is a typical middleman mode, more suitable for network-many of them, the two sides reached a consensus in the case and do not know each transaction. Analogy to: Customer ---> Timeout <- suppliers.

Use TurboMQ Notes:

1, to avoid the multi-threaded processing messages, reducing asynchronous request, do not open the extra Task to process the message

2, to reduce the ineffective push repeated, using a highly concurrent Redis can do some deduplication processing. 

The figure is on the market a number of message queue MQ:

 

Guess you like

Origin www.cnblogs.com/taotaozhuanyong/p/11762995.html