Sha256: 62c7e72d641926298801906ab186ed197988c8bc41d781a5a0f1c37a0b9d2002
Contents?: true
Size: 816 Bytes
Versions: 8
Compression:
Stored size: 816 Bytes
Contents
#!/usr/bin/env ruby # encoding: utf-8 require "rubygems" require "amqp" AMQP.start("amqp://guest:guest@dev.rabbitmq.com:5672/") do |connection, open_ok| puts "Connected" AMQP::Channel.new(connection) do |channel, open_ok| puts "Opened a channel" channel.on_error do |arg| raise "Channel-level exception: #{arg.inspect}" end exchange = channel.fanout("amq.fanout") channel.queue("", :auto_delete => true, :exclusive => true) do |queue, declare_ok| queue.bind(exchange) do |_| puts "Bound" end EventMachine.add_timer(0.5) do queue.unbind(exchange) do |_| puts "Unbound. Shutting down..." connection.close { EM.stop { exit } } end end # EventMachine.add_timer end # channel.queue end end
Version data entries
8 entries across 8 versions & 1 rubygems