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
[email protected]
http://rubyforge.org/mailman/listinfo/backgroundrb-devel

Reply via email to