[Backgroundrb-devel] what happened to get_worker?
hemant kumar
gethemant at gmail.com
Fri Dec 21 15:03:19 EST 2007
On Fri, 2007-12-21 at 09:51 -1000, Kevin W. English wrote:
> Hello, I recently upgraded to the new backgroundrb. I noticed that the
> "get_worker" method is gone. I am trying to create multiple instances of
> the same worker and retrieve the status of them using the job key:
>
> To create the worker, I do:
>
> @worker = MiddleMan.new_worker(:worker => :bar_worker,
> :worker_method => :echo_value,
> :job_key => @job_key,
> :data => {:param1 => 'val1',:param2 => 'val2' })
>
>
> To retrieve the worker, I have tried:
>
> @worker = MiddleMan.ask_status(:worker => :bar_worker, :job_key =>
> @job_key)
>
> but it does not work. I used to be able to do this with get_worker. Can
> someone explain how to use this feature with the new version?
>
What happens, you get an error?
Ok, You must register status of your worker before able to retrieve it
using ask_status. By default, all workers start with a status of nil.
So, make sure that in worker code, you are using register_status() to
register current status of worker.
More information about the Backgroundrb-devel
mailing list