Sha256: 918bb67e06e37ab1884e24aba784ff4be2dc30db1387d945eeb514e037b85a74

Contents?: true

Size: 757 Bytes

Versions: 1

Compression:

Stored size: 757 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|
      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

1 entries across 1 versions & 1 rubygems

Version Path
amqp-0.8.0.rc13 examples/guides/queues/11_deleting_a_queue.rb