From gethemant at gmail.com Thu Jun 11 09:34:20 2009 From: gethemant at gmail.com (hemant) Date: Thu, 11 Jun 2009 19:04:20 +0530 Subject: [Backgroundrb-devel] Handling over maintenance and development Message-ID: Folks, I am planning to hand over development and maintenance of BackgrounDRb. So if you have contributed to the library and would like to take over the the future work, please reply to this thread. -- Let them talk of their oriental summer climes of everlasting conservatories; give me the privilege of making my own summer with my own coals. http://gnufied.org From tov-backgroundrb at overkamp.org Tue Jun 23 06:27:25 2009 From: tov-backgroundrb at overkamp.org (Tobias Overkamp) Date: Tue, 23 Jun 2009 12:27:25 +0200 Subject: [Backgroundrb-devel] Exception Handling Message-ID: Hi folks! I'm still starting with BackgroundRB and I wonder if it is possible to to put some kind of exception handling (begin/rescue etc.) around each method in my worker. In the example below I want to make sure that the whole method could be processed correctly before I commit the data in the database. Of course I don't want to write the begin-rescue idiom in every method (DRY). Is there some kind of hook/callback that I'm missing? Sample: class TransferWorker < BackgrounDRb::MetaWorker set_worker_name :transfer_worker def request_transfer_from_registry begin ActiveRecord::Base.transaction do transfer = Order::OrderTransfer.new(:xml => args[:xml]) transfer.fetch_from_xml_by_id end rescue Exception => e #notify whomever... end end end Regards, Tobias From adam at thewilliams.ws Tue Jun 23 20:10:48 2009 From: adam at thewilliams.ws (Adam Williams) Date: Tue, 23 Jun 2009 20:10:48 -0400 Subject: [Backgroundrb-devel] Exception Handling In-Reply-To: References: Message-ID: <5CD66062-3150-4CA9-ACF8-077759756582@thewilliams.ws> I ended up creating a 'RobustWorker', which all our workers subclass. Then the methods use notify_on_failure :tries => 5 do work; end That method runs the block in a begin rescue, up to five times, sending me an email if it is never successful. Of course, any db work should be done in a transaction. HTH Adam Williams On Jun 23, 2009, at 6:27 AM, Tobias Overkamp wrote: > Hi folks! > I'm still starting with BackgroundRB and I wonder if it is possible > to to put some kind of exception handling (begin/rescue etc.) around > each method in my worker. > > In the example below I want to make sure that the whole method could > be processed correctly before I commit the data in the database. > Of course I don't want to write the begin-rescue idiom in every > method (DRY). Is there some kind of hook/callback that I'm missing? > > Sample: > > class TransferWorker < BackgrounDRb::MetaWorker > set_worker_name :transfer_worker > > > def request_transfer_from_registry > > begin > ActiveRecord::Base.transaction do > transfer = Order::OrderTransfer.new(:xml => args[:xml]) > transfer.fetch_from_xml_by_id > end > rescue Exception => e > #notify whomever... > end > > end > > end > > > Regards, > > Tobias > _______________________________________________ > Backgroundrb-devel mailing list > Backgroundrb-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/backgroundrb-devel