Hi, Samer<br><br>Thanks for the quick reply.   I changed things a bit and ran this<br><br>&gt;&gt;  MiddleMan.new_worker(:worker=&gt;:notification_worker,:worker_key=&gt;&#39;testkey&#39;,:data=&gt;&quot;data arguement&quot;) <br>
=&gt; &quot;testkey&quot;<br>&gt;&gt; MiddleMan.worker(:notification_worker,&#39;testkey&#39;).enq_send_warranty_notice(:job_key=&gt;Time.now.to_s,:arg =&gt; &quot;asdf&quot;,:scheduled_at =&gt; Time.now + 3.second)<br>=&gt; true<br>
<br>... but the arg is still not being passed.<br><br>My understanding of new_worker is it explictly creates a worker for you that you can refer to by the key, so <br><br>If I do this:<br><br>      MiddleMan.worker(:notification_worker,&#39;testkey&#39;)     <br>
<br>I&#39;m getting the worker I created above but when I call this:<br><br>     MiddleMan.worker(:notification_worker)<br><br>I&#39;m getting the default worker that was created at startup.<br><br>Regardless of how the worker is created the &quot;arg&quot; parameter is still not being passed when it gets invoked to do enqued work.   Going through the code ... I can&#39;t figure out how it gets invoked.<br>
<br>Thanks<br>Justin<br><br><br><br><br><br><div class="gmail_quote">On Fri, Mar 13, 2009 at 5:55 PM, Samer Masry <span dir="ltr">&lt;<a href="mailto:enzodm@gmail.com">enzodm@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div style=""><div>Here&#39;s the usage</div><div>When creating a worker the :create method gets called with args you pass this  in with the :data argument to new_worker</div><div><br></div><div>MiddleMan.new_worker( :worker =&gt; :notification_worker, :worker_key =&gt; &#39;test&#39;, :data =&gt; &quot;some argument&quot; )</div>
<div><br></div><div>a bit confusing on the names but it is documented.  The create method says args even though you pass it in as data</div><div><br></div><div>When sending args to your method after you worker is created use something like</div>
<div><br></div><div>MiddleMan.worker( :notification_worker, &#39;test&#39;).enq_some_task( :arg =&gt; &quot;some argument&quot; )</div><div><br></div>Hope that helps<div><br></div><div>Samer Masry</div><div><a href="http://www.dryblis.com" target="_blank">www.dryblis.com</a></div>
<div><br><div><div><div></div><div class="h5"><div>On Mar 12, 2009, at 9:22 PM, Justin Wood wrote:</div><br></div></div><blockquote type="cite"><div><div></div><div class="h5">Hi, All<br><br>It appears that when you enque a task, backgroundrb doesn&#39;t pass the &quot;arg&quot; parameter when running the enqued method.<br>
<br>This is my worker:<br><br>class NotificationWorker &lt; BackgrounDRb::MetaWorker<br>   set_worker_name :notification_worker<br><br> def create(args = nil)<br>   <a href="http://logger.info" target="_blank">logger.info</a>(&quot;Args: #{args}&quot;)<br>
 end<br><br>  def send_warranty_notice(data)<br>      <a href="http://logger.info" target="_blank">logger.info</a> &quot;Sending warranty notice id is #{data}&quot;<br>   end<br>end<br><br>Here&#39;s how I call it from IRB<br>
<br>MiddleMan.worker(:notification_worker).enq_send_warranty_notice(:arg=&gt;&quot;asdf&quot;,:job_key=&gt;Time.now.to_s,:scheduled_at =&gt; Time.now + 3.seconds)<br> <br>The &quot;send_warranty_notice&quot; method gets called but the parameter passed (data) is nil.<br>
<br><br>Calling async_method works fine:<br><br>MiddleMan.worker(:notification_worker).async_send_warranty_notice(:arg=&gt;&quot;asdf&quot;)<br> <br>prints out &quot;Sending warranty notice id is asdf&quot; in the drb log.<br>
<br>Also I noticed that on the following page  <a href="http://backgroundrb.rubyforge.org/workers/" target="_blank">http://backgroundrb.rubyforge.org/workers/</a> the following text <br> <pre>MiddleMan(:hello_worker).enq_some_task(:arg =&gt; &quot;hello_world&quot;,:job_key =&gt; &quot;boy&quot;)<br>
<br>should read<br><br>MiddleMan.worker(:hello_worker).enq_some_task(:arg =&gt; &quot;hello_world&quot;,:job_key =&gt; &quot;boy&quot;)  ... unless I am missing something?<br>
<br><br>Any suggestions on how I can fix the arg passing problem?<br><br><br>Regards<br>Justin Wood<br><br><br><br></pre><br><br><br></div></div> _______________________________________________<br>Backgroundrb-devel mailing list<br>
<a href="mailto:Backgroundrb-devel@rubyforge.org" target="_blank">Backgroundrb-devel@rubyforge.org</a><br><a href="http://rubyforge.org/mailman/listinfo/backgroundrb-devel" target="_blank">http://rubyforge.org/mailman/listinfo/backgroundrb-devel</a></blockquote>
</div><br></div></div></blockquote></div><br>