Method: Cloudist.handle
- Defined in:
-
lib/cloudist.rb,
lib/cloudist_old.rb
Registers a worker class to handle a specific queue
Cloudist.handle('make.sandwich', 'eat.sandwich').with(MyWorker)
A standard worker would look like this:
class MyWorker < Cloudist::Worker
def process
log.debug(data.inspect)
end
end
A new instance of this worker will be created everytime a job arrives
Refer to examples.
130 131 132 133 134 135 136 137 138 139 |
# File 'lib/cloudist.rb', line 130 def handle(*queue_names) class << queue_names def with(handler) self.each do |queue_name| Cloudist.register_worker(queue_name.to_s, handler) end end end queue_names end |