Proper way of utilizing gearman with my php application
For now I just want to use Gearman for background processing. For example, I need to email a recipient that they have a private message waiting for them once the sender submits their message into the 开发者_如何学编程DB. I assume I can run the worker/client and server on my primary server but I have no problems offloading some of the tasks to a different web server.
Anyways, my question is how do I handle multiple "functions?" Let's say I need a job that handles the email portion and a job to handle image manipulation. Can I have multiple functions in the worker? I've followed a couple of examples I found online but each example only shows one function being initialized. Do I have to start up multiple "workers" to handle multiple functions?
Can I have multiple functions in the worker? I've followed a couple of examples I found online but each example only shows one function being initialized.
When you register with the Gearman server, you tell it all the things you can handle. Check out the GearmanWorker class and the addFunction method. (This blindly assumes you're using that particular Gearman extension. There are others.)
精彩评论