Hemant Kumar wrote:
> On Mon, Jun 9, 2008 at 6:19 AM, Mozmonkey <[EMAIL PROTECTED]> 
> wrote:
>> gems.  I've also read through their documentation to see if I could
>> figure out what the problem is -- haven't found anything yet.  Until I
>> get this worked out I have installed Spawn and it seems to work on my
>> local environment fine.  I'm worried how that'll work in production,
>> so I'd like to get this figured out if possible.
> 
> Well, no worker method will accept two arguments in your code snippet
> you are trying exactly the same.
> If you want two arguments, i am afraid, you will have to pass them as an 
> array.

I'm sure this is resolved by now, one way or the other, but i found that 
it's simpler to pass all your arguments inside a single hash, eg

MiddleMan.worker(:invite_worker).send_invite_emails_test(:arg => 
{:event_id => @event.id, :send_to => send_to})

Then pull out at the other end just like a normal hash:

def send_invite_emails_test(arg_hash)
    logger.debug("Start message...")
    event = Event.find(arg_hash[:event_id])
    ...etc
  end


Also, if you send through an active record object (which i know you 
aren't doing), then it will die silently with no logging output 
anywhere.  That's my experience anyway.  Just mentioning for future 
browsers of this thread.

WRT logging, this probably isn't the smartest answer but the only way i 
could do it was to make a new logger inside the worker: eg from one of 
mine

class LmailWorker < BackgrounDRb::MetaWorker
  set_worker_name :lmail_worker

  @@logger = Logger.new("log/backgroundrb_custom.log")

  def ldb(debug_text)
    @@logger.info "### #{caller[0]}: #{debug_text}"
  end

  def send_mail(arg_hash)
    ldb "arg_hash = #{arg_hash.inspect}"
    ...etc


-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to