Workerd ======= Workerd is a Ruby on Rails plugin which helps running tasks in the background. It is inspired by Bart ten Brinke's worker_queue. Example ======= Create a background job: Workerd::Workpiece.create(:class_name => 'Model', :method_name => 'method') This new job will get picked up by a worker and he will execute Model.method with no arguments. You can add an argument with the :method_argument option, e.g. :method_argument => [17, 'foo', Time.now] Run one worker in foreground during development: rake workerd:run Start one worker in background: rake workerd:start Stop it: rake workerd:stop Customization ============= You can easily create your own jobs with advanced features by inheriting from Workerd::Workpiece and adding a `type` column. For example you can then define a column `progress` as an integer in your database. After this you can use it from your foreground and background code: # in a normal rails request job = MyJob.create(:class_name => 'Foo', :method_name => 'bar') # in an AJAX request render :text => job.progress # in Foo.bar Workerd.current_workpiece.progess = 77 Workerd.current_workpiece.save! Copyright (c) 2010 Marius Nuennerich, released under the MIT license