Sha256: 373b72bd9bae1f35d41e836a8aa468316fa3d97575068ab5149a22b20c2155b8
Contents?: true
Size: 902 Bytes
Versions: 2
Compression:
Stored size: 902 Bytes
Contents
# Cloudst Example: Sandwich Worker # # This example demonstrates receiving a job and sending back events to the client to let it know we've started and finsihed # making a sandwich. From here you could dispatch an eat.sandwich event. # # Be sure to update the Cloudist connection settings if they differ from defaults: # user: guest # pass: guest # port: 5672 # host: localhost # vhost: / # $:.unshift File.dirname(__FILE__) + '/../lib' require "rubygems" require "cloudist" class SandwichWorker < Cloudist::Worker def process log.info("Processing queue: #{queue.name}") log.info(data.inspect) job.started! (1..20).each do |i| job.progress(i * 5) sleep(1) raise ArgumentError, "NOT GOOD!" if i == 4 end job.finished! end end Cloudist.signal_trap! Cloudist.start { Cloudist.handle('make.sandwich', 'eat.sandwich').with(SandwichWorker) }
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cloudist-0.2.1 | examples/sandwich_worker_with_class.rb |
cloudist-0.2.0 | examples/sandwich_worker_with_class.rb |