Sha256: 373a2cd3f1e224179d9e8c82cb84e3236b417d35967d0082dd46777d8833ec18

Contents?: true

Size: 765 Bytes

Versions: 46

Compression:

Stored size: 765 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 few 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

46 entries across 46 versions & 1 rubygems

Version Path
amqp-1.8.0 examples/patterns/command/producer.rb
amqp-1.7.0 examples/patterns/command/producer.rb
amqp-1.6.0 examples/patterns/command/producer.rb
amqp-1.5.3 examples/patterns/command/producer.rb
amqp-1.5.2 examples/patterns/command/producer.rb
amqp-1.5.1 examples/patterns/command/producer.rb
amqp-1.5.0 examples/patterns/command/producer.rb
amqp-1.4.2 examples/patterns/command/producer.rb
amqp-1.4.1 examples/patterns/command/producer.rb
amqp-1.4.0 examples/patterns/command/producer.rb
amqp-1.3.0 examples/patterns/command/producer.rb
amqp-1.2.1 examples/patterns/command/producer.rb
amqp-1.2.0 examples/patterns/command/producer.rb
amqp-1.1.8 examples/patterns/command/producer.rb
amqp-1.1.7 examples/patterns/command/producer.rb
amqp-1.1.6 examples/patterns/command/producer.rb
amqp-1.1.5 examples/patterns/command/producer.rb
amqp-1.1.4 examples/patterns/command/producer.rb
amqp-1.1.3 examples/patterns/command/producer.rb
amqp-1.0.4 examples/patterns/command/producer.rb