Sha256: 97122c1a3d125ecab8e3ee1abd9c5a2da3b198855519011ae45d639a2704e663

Contents?: true

Size: 832 Bytes

Versions: 36

Compression:

Stored size: 832 Bytes

Contents

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

require "bundler"
Bundler.setup

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

AMQP.start(:host => "localhost") do |connection|

  # Send Connection.Close on Ctrl+C
  trap(:INT) do
    unless connection.closing?
      connection.close { exit! }
    end
  end

  @counter = 0
  amq = AMQP::Channel.new

  amq.prefetch(64, false) do
    puts "basic.qos callback has fired"
  end

  amq.recover do
    puts "basic.recover callback has fired"
  end

  10.times do
    amq.queue("") do |queue|
      puts "Queue #{queue.name} is now declared."
      puts "All queues: #{amq.queues.map { |q| q.name }.join(', ')}"

      @counter += 1
    end
  end

  EM.add_timer(0.3) do
    connection.disconnect do
      puts "AMQP connection is now closed."
      EM.stop
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
amqp-0.9.10 examples/legacy/callbacks.rb
amqp-0.9.9 examples/legacy/callbacks.rb
amqp-0.9.8 examples/legacy/callbacks.rb
amqp-0.9.7 examples/legacy/callbacks.rb
amqp-0.9.6 examples/legacy/callbacks.rb
amqp-0.9.5 examples/legacy/callbacks.rb
amqp-0.9.4 examples/legacy/callbacks.rb
amqp-0.9.3 examples/legacy/callbacks.rb
amqp-0.9.2 examples/legacy/callbacks.rb
amqp-0.9.1 examples/legacy/callbacks.rb
amqp-0.9.0 examples/legacy/callbacks.rb
amqp-0.9.0.pre3 examples/legacy/callbacks.rb
amqp-0.9.0.pre2 examples/legacy/callbacks.rb
amqp-0.9.0.pre1 examples/legacy/callbacks.rb
amqp-0.8.4 examples/legacy/callbacks.rb
amqp-0.8.3 examples/legacy/callbacks.rb
amqp-0.8.2 examples/legacy/callbacks.rb
amqp-0.8.1 examples/legacy/callbacks.rb
amqp-0.8.0 examples/legacy/callbacks.rb
amqp-0.8.0.rc15 examples/legacy/callbacks.rb