The queue implementation seems simple, I would like to ask, in the case of sending a large number of messages, into the queue and eliminate the queue, certainly not in the unified time to do it, For example, I call inqueue.php into the queue to send the email address, dequeue.php send the message and eliminate the minus queue, these two certainly not run together? or in the queue.php. Advanced queue in the elimination queue if that's the case, what's the difference between using a loop?
谁能以发送大量邮件为例子给解释下队列的实际用法吗
Reply content:
The queue implementation seems simple, I would like to ask, in the case of sending a large number of messages, into the queue and eliminate the queue, certainly not in the unified time to do it, For example, I call inqueue.php into the queue to send the email address, dequeue.php send the message and eliminate the minus queue, these two certainly not run together? or in the queue.php. Advanced queue in the elimination queue if that's the case, what's the difference between using a loop?
谁能以发送大量邮件为例子给解释下队列的实际用法吗
How the queue works you basically do not need to consider, as long as the use of out-of-the-box queue, such as HTTPSQS, simple Message Queuing, FIFO, HTTP operation, easy to use, only the relationship between into row and dequeue, as to what is used, such as mail sending, bulk data writing, text messaging, It can be done asynchronously, as far as the queue completes
Refer to this: http://segmentfault.com/q/1010000000750317/a-1020000000750367
The essence is asynchronous and blocking.
No queues
Enter the operating platform
Click the Send button
etc...
etc...
Hey...... How not to react ...
Or a little more humane, add a progress bar
After n minutes, the operation is completed
In this process, you are not able to do anything.
Using queues
Enter the operating platform
Click the Send button
(Want to wait, want to lazy, no way, is over)
Continue with other operations.
I also mentioned this question a few days ago and you're a little more similar here
Now I think the solution is to put the task in the queue to the background execution, as for your problem, the advantage of the queue is that you send a task, to the worker to execute, you can continue to do what you want to do, and then through the event monitoring to record each item execution success, after successful elimination.
PHP Words with Gearman is good, or Redis to handle the queue