Re: Re: Net_Gearman Problems

From: Date: Thu, 05 Jun 2008 17:58:32 +0000
Subject: Re: Re: Net_Gearman Problems
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-50236@lists.php.net to get a copy of this message
On Jun 5, 2008, at 10:01 AM, Joshua Eichorn wrote:
This isn't a big deal for me right now i have 3 jobs i'm using but its mainly a style thing. Normally a worker includes every class anyway so i'm not sure what the gain of having Net_Gearman require the code and create the instance is. If the user can do that I get a lot of flexibility plus i don't have to store all my jobs in the dir specified by the define.
The gain is you don't have to worry about loading and running your jobs. It's done automagically by the worker. Also, the benefit is that you can lazily load your jobs rather than including, instantiating and referencing your jobs (this becomes more important the more addicted you get to Gearman and, as a result, have dozens of jobs). I think what you're asking for, and something I'm in favor of, is the ability to pass a valid PHP callback to addAbility(). $worker->addAbility('myJobHere', array($job, 'someFunction')); We could have a Net_Gearman_Job_Interface too that you could pass in. You could: 1.) Use it as it stands today. 2.) Pass an instance of an object that implements Net_Gearman_Job_Interface. 3.) Pass a valid PHP callback. Does that work? --Joe

« previous php.pear.dev (#50236) next »