Sha256: 128320f4da0d0062629bc7d6b42f814958f22e33b92cfb9d1830a89fbe779437

Contents?: true

Size: 731 Bytes

Versions: 8

Compression:

Stored size: 731 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|
      EventMachine.add_timer(0.5) do
        queue.delete do
          puts "Deleted #{queue.name}"
          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

Version Path
amqp-0.8.0.rc11 examples/guides/queues/12_deleting_a_queue.rb
amqp-0.8.0.rc10 examples/guides/queues/12_deleting_a_queue.rb
amqp-0.8.0.rc9 examples/guides/queues/12_deleting_a_queue.rb
amqp-0.8.0.rc8 examples/guides/queues/12_deleting_a_queue.rb
amqp-0.8.0.rc7 examples/guides/queues/12_deleting_a_queue.rb
amqp-0.8.0.rc6 examples/guides/queues/12_deleting_a_queue.rb
amqp-0.8.0.rc5 examples/guides/queues/12_deleting_a_queue.rb
amqp-0.8.0.rc4 examples/guides/queues/12_deleting_a_queue.rb