A queue problem with short mail and group email

80 4

In recent years, a group of and programs, because certain restrictions, are the interface to request responses multiple times, to achieve.

And then there's a problem: I need to send mail to 100 customers, the response time of the interface is average, and then my php needs to perform 100 post operations on the interface,.

How to solve this problem without changing php settings?

I can think about two scenarios:

  • Each post, and then page jump, just one small request, such as seconds, can be done at a time, and then jump to the new page, and then jump to the new page, and the jump. The drawback is that the client has to keep the browser in touch with the browser.
  • The task of sending a message in a database, doing a send, php, and a file that sends one or more messages to send, then to check for a new task per second.

I'd like to know that there's no other simple method, such as I've heard about rabbitmq, but not to understand. ..

5 Answers

94 1

It's a good way to place a background task, and it should be the best way to do it, and it'll only make the problem complex. But there's actually a way to get your php out of time, even if the user browser is disconnected, it'll continue, and that's the first two lines in your php file