There is something wrong with your setup. MetaWorker shouldn't be even shown in controller/rails part of things.
Can you post your worker code and how are you invoke BackgrounDRb worker tasks from rails?
There is something wrong with your setup. MetaWorker shouldn't be even shown in controller/rails part of things.
Can you post your worker code and how are you invoke BackgrounDRb worker tasks from rails?
Hemant Kumar wrote:
There is something wrong with your setup. MetaWorker shouldn't be even shown in controller/rails part of things.
Can you post your worker code and how are you invoke BackgrounDRb worker tasks from rails?
This is my worker definition. I use ruby script/generate worker MakeView to generate this worker.
class MakeViewWorker < BackgrounDRb::MetaWorker set_worker_name :make_view_worker attr_reader :process def create(args) # this method is called, when worker is loaded for the first time process=0 while process < 100 sleep 1 process = process+1 end end end
This is the code I used to invoke this worker.
session[:make_view_job]=MiddleMan.new_worker(:class=>make_view_worker, :args=>{:product_name=>@project_name, :user_name=>@user_name, :version=>@project_version})
I have a feeling that you are mixing up syntax of BackgrounDRb across its varied releases.
For example, syntax for creating new workers is:
I know what wrong. I should use this code:
used_job_key = MiddleMan.new_worker(:worker => :foo_worker,\ :worker_key => "my_secret_job_key")
to get a worker. But after this, how can I invoke the worker with this key?
examples are right there in the docs. For example to invoke the worker:
MiddleMan.worker(:foo_worker,"my_secret_worker_key").async_do_foo()
examples are right there in the docs. For example to invoke the worker:
MiddleMan.worker(:foo_worker,"my_secret_worker_key").async_do_foo()
thanks it works. but when I call this method I will get this error. I have started backgroundrb server.
can't dump TCPSocket
vendor/plugins/backgroundrb/lib/backgroundrb/bdrb_connection.rb:72:in `dump' vendor/plugins/backgroundrb/lib/backgroundrb/bdrb_connection.rb:72:in `dump_object' vendor/plugins/backgroundrb/lib/backgroundrb/bdrb_connection.rb:86:in `ask_work' vendor/plugins/backgroundrb/lib/backgroundrb/rails_worker_proxy.rb:86:in `send' vendor/plugins/backgroundrb/lib/backgroundrb/rails_worker_proxy.rb:86:in `invoke_on_connection' vendor/plugins/backgroundrb/lib/backgroundrb/rails_worker_proxy.rb:72:in `run_method' vendor/plugins/backgroundrb/lib/backgroundrb/rails_worker_proxy.rb:25:in `method_missing'
Please read the API docs carefully, rather than getting spoon fed here on the list. These things are clearly mentioned on http://backgroundrb.rubyforge.org