Sha256: 6600ddb693a6b60def19a46ec093833424041b84b684af75b556a014318cf7d3

Contents?: true

Size: 872 Bytes

Versions: 2

Compression:

Stored size: 872 Bytes

Contents

# Cloudst Example: Sandwich Client
# 
# This example demonstrates dispatching a job to the worker and receiving event callbacks.
# 
# 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("Dispatching sandwich making job...")
  enqueue('make.sandwich', {:bread => 'white'})
  
  # Listen to all sandwich jobs
  listen('make.sandwich') {
    progress {
      Cloudist.log.info("Progress: #{data[:progress]}")
    }
    
    event('started') {
      Cloudist.log.info("Started making sandwich at #{Time.now.to_s}")
    }
    
    event('finished'){
      Cloudist.log.info("Finished making sandwich at #{Time.now.to_s}")
    }
  }
  
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cloudist-0.1.1 examples/sandwich_client.rb
cloudist-0.1.0 examples/sandwich_client.rb