Sha256: b84d34496a891ccf356041707437d73fd11fee2aacdb445c5b2d956bf97c6bb7
Contents?: true
Size: 842 Bytes
Versions: 1
Compression:
Stored size: 842 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 |ch, channel_close| raise "Channel-level exception: #{channel_close.reply_text}" 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
amqp-0.8.0.rc13 | examples/guides/queues/09_unbinding_from_exchange.rb |