RabbitMQ characteristics and application scenario (ii)

 

1, RabbitMQ main features

(1) Reliability: RabbitMQ through the queue may be persistent, the switch persistent, and persistent ACK message response mechanisms to ensure the reliability

(2) Support for multiple languages ​​and protocols: RabbitMQ supports almost all programming languages, supports AMQP, STOMP, MQTT other protocols

(3) Management Interface: RabbitMQ a visual management interface can be used to directly view the status and operation of RabbitMQ

(4) flexible extensions: RabbitMQ node comprises a plurality of clusters, the mirror may be disposed in the queue machines in the cluster, so that the team is still available in the event of a problem node portion

2, RabbitMQ main scenario

(1) decoupling

Such as order - inventory system, the traditional ordering process after an order is successful, immediately reduce inventory, inventory system has a strong dependence, if inventory system problems, call the inventory system fails, the data is rolled back, resulting in failure to create orders

 

 

RabbitMQ treated using the process, after an order is successful, the message is written to the message queue, the system inventory data taken from the message queue to go, do their own inventory reduction operation, so even if there is a problem inventory system, orders are still able to create success. However, this approach is likely to cause data inconsistency orders and inventory, pay attention to the persistence RabbitMQ or other strategies to ensure data consistency

 

(2) Asynchronous Processing

Operations such as user needs to send registration information and mail to the user

If the traditional way, then after successful registration Send> e-mail two serial operation, long execution time

If RabbitMQ way, after registering successfully written to a message queue message, is much smaller than the time to write or texting message time, and then to send text messages and e-mail, since these two operations substantially simultaneously, so that two operation can be seen as a parallel operation, saving time

 

(3) Processing log

A project requires a wide variety of log to record the operation, the calling process and so on, log system does not require real-time, using the message queue processing is very convenient

(4) flow clipping

Based on the message queue is a queue in spike activity, when writing a message queue reaches a certain value, no longer write the message queue, and jump to the end of the event page, due to the characteristics of the FIFO queue, but also to ensure spike spike activity of the order

 

Next chapter: RabbitMQ switch type (c)

Guess you like

Origin www.cnblogs.com/php-linux/p/11293880.html