Sha256: 26fc00a7f449b71083f1e0e62f0519e8fee770984f45a134cb70573ab24ea21d

Contents?: true

Size: 763 Bytes

Versions: 7

Compression:

Stored size: 763 Bytes

Contents

# encoding: utf-8

$LOAD_PATH.unshift File.expand_path("../../../../lib", __FILE__)

require "amqp"
require "yaml"

t = Thread.new { EventMachine.run }
sleep(0.5)

connection = AMQP.connect
channel    = AMQP::Channel.new(connection)

# publish new commands every 3 seconds
EventMachine.add_periodic_timer(10.0) do
  puts "Publishing a command (gems.install)"
  payload = { :gem => "rack", :version => "~> 1.3.0" }.to_yaml

  channel.default_exchange.publish(payload,
                                   :type        => "gems.install",
                                   :routing_key => "amqpgem.examples.patterns.command")
end

puts "[boot] Ready. Will be publishing commands every 10 seconds."
Signal.trap("INT") { connection.close { EventMachine.stop } }
t.join

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
amqp-0.8.4 examples/patterns/command/producer.rb
amqp-0.8.3 examples/patterns/command/producer.rb
amqp-0.8.2 examples/patterns/command/producer.rb
amqp-0.8.1 examples/patterns/command/producer.rb
amqp-0.8.0 examples/patterns/command/producer.rb
amqp-0.8.0.rc15 examples/patterns/command/producer.rb
amqp-0.8.0.rc14 examples/patterns/command/producer.rb