The actual application of the queue, such as sending mail!!!

Source: Internet
Author: User
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

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.