[Backgroundrb-devel] Best way to start a worker

Jim Scott jim.scott at yahoo.com
Thu Apr 5 20:57:02 EDT 2007


I have installed backgroundrb.  I can start it.  I have read everything I
can get my hands on, and have read the list for a few months.  I have
written a worker, and am ready to start.

 

This worker reads a queue, and processes it (sends queued emails). Sends 10,
sleeps for a minute, sends 10 until done - very straightforward.

 

My question is, what would be the best way to run this?  I have assumed a
cron like scheduled worker with a named key, but I don’t know.  My worker
looks like this:

 

class EmailProcessorWorker < BackgrounDRb::Worker::RailsBase

  def do_work(args)

    queue = EmailQueue.new

    queue.process_queue

  end

end

EmailProcessorWorker.register

 

I do all the work in a Rails Model, since I can unit test it outside of
backgroundrb.

 

Does anyone have a backgroundrb_schedules.yml file I could use as an
example, and should this run something like every 15 minutes, etc., or
should it start once, and loop endlessly inside do_work?  Any thoughts or
experience?

 

Thanks for your input –

 

Jim Scott

 


-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.26/746 - Release Date: 4/4/2007
1:09 PM
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20070405/6297ea40/attachment-0001.html 


More information about the Backgroundrb-devel mailing list