Sha256: d803bf279cc4cc741b5ac5e96e5d3b582c20e87e4ccba05c459e11e59575d877

Contents?: true

Size: 828 Bytes

Versions: 7

Compression:

Stored size: 828 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"

Cloudist.signal_trap!

Cloudist.start {
  log.info("Started Worker")
  
  job('make.sandwich') {
    log.info("JOB (#{id}) Make sandwich with #{data[:bread]} bread")
    
    job.started!
    
    (1..20).each do |i|
      job.progress(i * 5)
      sleep(1)
      
      raise ArgumentError, "NOT GOOD!" if i == 4
    end
    job.finished!
  }
  
}

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
cloudist-0.5.0 examples/sandwich_worker.rb
cloudist-0.4.4 examples/sandwich_worker.rb
cloudist-0.4.3 examples/sandwich_worker.rb
cloudist-0.4.2 examples/sandwich_worker.rb
cloudist-0.4.1 examples/sandwich_worker.rb
cloudist-0.2.1 examples/sandwich_worker.rb
cloudist-0.2.0 examples/sandwich_worker.rb