Hi, All
It appears that when you enque a task, backgroundrb doesn't pass the "arg"
parameter when running the enqued method.
This is my worker:
class NotificationWorker < BackgrounDRb::MetaWorker
set_worker_name :notification_worker
def create(args = nil)
logger.info("Args: #{args}")
end
def send_warranty_notice(data)
logger.info "Sending warranty notice id is #{data}"
end
end
Here's how I call it from IRB
MiddleMan.worker(:notification_worker).enq_send_warranty_notice(:arg=>"asdf",:job_key=>Time.now.to_s,:scheduled_at
=> Time.now + 3.seconds)
The "send_warranty_notice" method gets called but the parameter passed
(data) is nil.
Calling async_method works fine:
MiddleMan.worker(:notification_worker).async_send_warranty_notice(:arg=>"asdf")
prints out "Sending warranty notice id is asdf" in the drb log.
Also I noticed that on the following page
http://backgroundrb.rubyforge.org/workers/ the following text
MiddleMan(:hello_worker).enq_some_task(:arg => "hello_world",:job_key => "boy")
should read
MiddleMan.worker(:hello_worker).enq_some_task(:arg =>
"hello_world",:job_key => "boy") ... unless I am missing something?
Any suggestions on how I can fix the arg passing problem?
Regards
Justin Wood
_______________________________________________
Backgroundrb-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/backgroundrb-devel