tags:

views:

66

answers:

1

I am designing a RabbitMQ based message processing system for use with various PHP based web applications. PHP daemons will be used to retrieve items from a queue and perform processing.

The idea is for example, emailing hundreds of receipients, the message queue will do it asyncronously to the web application.

My question is, with this type of system, what would be the best way to

  1. Detect the progress of emails sent ie (2/100)
  2. Know when the entire process is complete.
  3. When 2 is known, send a message back to the web application when the entire process is complete?

For 1, I think the daemon would send a message to a completion queue, but where would the code for items 2 and 3 be placed?

Hope that makes sense.

K

A: 

Looks like you need eventing :)... PHP (unlike Java) does not provide eventing, so the only option I can see is for the webserver to poll the daemon process. Alternatively, the daemon can write the completion status to a static file which can be polled by the webserver (a little performance improvement). The poller could be a javascript infinite loop (break on success type) which keeps making the ajax request to the file or webserver.

You can also look at Comet (server push) method, where the daemon can push the data to the server on completion.

Let me know if this helps or you need any other details.

regards pinaki

pinaki
thanks for the tips, I'll check them out.
kaylnn