1. Q: What is Message Queuing?
A: is a linked list of messages and is an asynchronous processing engine.
2. Q: What are the benefits?
A: Not only can increase the load of the system, but also can improve the data loss caused by network congestion.
3. Q: What are the uses?
A: Mail sending, SMS sending, data form submission, image generation, video conversion, log storage, etc.
4, Q: What software?
A: ZeroMQ, Posix, Squirrelmq, Redis, qdbm, Tokyo tyrant, HTTPSQS, etc. (under Linux platforms).
5, Q: How to achieve?
A: As the name implies, first queue, after the team, first throw the data into the message queue, and then according to the corresponding key to obtain data (out of the team).
6. Q: Can redis do Message Queuing?
A: First, Redis is designed to be cached, but because of its own nature it can be used to do Message Queuing, it has a few blocking API can be used, it is these blocking API to have the ability to do Message Queuing, in addition, Other features of Message Queuing, such as FIFO (first-in, first-out), are also easy to implement, requiring only a list object to fetch data from scratch, to plug data from the tail, and redis to do Message Queuing thanks to its list object Blpop Brpop interface and some interfaces of pub/sub (Publish/subscribe) , they are all blocked, so they can be used as message queues.
7, Q: How to do (based on thinkphp)?
A: 7.1 Installation of Redis, process (slightly);
7.2 Installation Php-redis extension, process (slightly);
7.3 Post Code
Figure 1 The queue
Figure 2 Queued Results
Figure 3 The Team
Figure 4 The results of the team
Figure 5 Complete code
8, Summary: Redis's Lpush command inserts one or more values into the list header is the opposite of Rpush and Rpush; the Rpop command is used to overflow and return the last element of the list to the opposite of Lpop.
Redis implements a simple message queue