Sha256: 6e92c2fda7cf894a82b94934f31328b2a46a21312ef8b9750b3c463df678e9f0

Contents?: true

Size: 669 Bytes

Versions: 10

Compression:

Stored size: 669 Bytes

Contents

#!/usr/bin/env ruby
# encoding: utf-8

require "bundler"
Bundler.setup

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

require 'amqp'

EventMachine.run do
  connection = AMQP.connect(:host => '127.0.0.1')
  puts "Connected to AMQP broker. Running #{AMQP::VERSION} version of the gem..."

  channel  = AMQP::Channel.new(connection)
  queue    = channel.queue("amqpgem.examples.hello_world", :auto_delete => true)
  exchange = channel.direct("")

  queue.subscribe do |payload|
    puts "Received a message: #{payload}. Disconnecting..."

    connection.close {
      EM.stop { exit }
    }
  end

  exchange.publish "Hello, world!", :routing_key => queue.name
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
amqp-0.8.0.rc12 examples/hello_world.rb
amqp-0.8.0.rc11 examples/hello_world.rb
amqp-0.8.0.rc10 examples/hello_world.rb
amqp-0.8.0.rc9 examples/hello_world.rb
amqp-0.8.0.rc8 examples/hello_world.rb
amqp-0.8.0.rc7 examples/hello_world.rb
amqp-0.8.0.rc6 examples/hello_world.rb
amqp-0.8.0.rc5 examples/hello_world.rb
amqp-0.8.0.rc4 examples/hello_world.rb
amqp-0.8.0.rc3 examples/hello_world.rb