The actual application of the queue, such as sending an email !!!

Source: Internet
Author: User
The queue implementation seems simple. I would like to ask, for example, when sending a large number of emails, entering the queue and eliminating the queue are definitely not performed at the same time. For example, I call inqueue. php adds the email address to be sent to the queue, dequeue. PHP sends emails and removes the queues... the queue implementation seems simple. I would like to ask, for example, when sending a large number of emails, entering the queue and eliminating the queue are definitely not performed at the same time. For example, I call inqueue. php adds the email address to be sent to the queue, dequeue. PHP sends emails and removes the queues. Are these two certainly not running together ?. Or in queue. php, what is the difference between advanced queues and loops in eliminating queues?

Who can explain the actual use of the queue by sending a large number of emails?

Reply content:

The queue implementation seems simple. I would like to ask, for example, when sending a large number of emails, entering the queue and eliminating the queue are definitely not performed at the same time. For example, I call inqueue. php adds the email address to be sent to the queue, dequeue. PHP sends emails and removes the queues. Are these two certainly not running together ?. Or in queue. php, what is the difference between advanced queues and loops in eliminating queues?

Who can explain the actual use of the queue by sending a large number of emails?

You don't need to consider how queues operate. You just need to use existing queues, such as httpsqs, simple message queues, first-in-first-out, http operations, and ease of use, only link to the columns and columns. What is the purpose? For example, sending emails, writing a large amount of data, sending text messages, or performing asynchronous operations, the queue should be completed as far as possible.

Refer to this: http://segmentfault.com/q/1010000000750317/a-1020000000750367

In essence, it is asynchronous and blocking.

No queue

Go to the operating platform

Click send.

......

......

...... No response ......

Or add a progress bar.

After N minutes, the operation is completed.

In this process, you cannot perform any operations.

Queue

Go to the operating platform

Click send.

(I want to wait. I want to be lazy. It's over)

Continue with other operations.

I raised this question a few days ago. It is similar to yours here.
Now I want to solve the problem by handing the task to the backend for execution. The advantage of the queue is that you have sent a task and handed it to the worker for execution, you can continue to do what you want, and then use event listening to record whether each entry is successfully executed and then eliminate it.

In php, it would be nice to use gearman, or redis to process 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.