Sha256: 5547b579a60b48b8129e09e1652280369377a183937daed63aad0bbd095bf7bf

Contents?: true

Size: 719 Bytes

Versions: 12

Compression:

Stored size: 719 Bytes

Contents

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

require "bundler"
Bundler.setup

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

require 'bunny'

conn = Bunny.new(heartbeat_timeout: 8, automatically_recover: false)
conn.start

ch = conn.create_channel
x  = ch.topic("bunny.examples.recovery.topic", :durable => false)
q  = ch.queue("bunny.examples.recovery.client_named_queue2", :durable => true)
q.purge

q.bind(x, :routing_key => "abc").bind(x, :routing_key => "def")

loop do
  sleep 1.5
  body = rand.to_s
  puts "Published #{body}"
  x.publish(body, :routing_key => ["abc", "def"].sample)

  sleep 1.5
  _, _, payload = q.pop
  if payload
    puts "Consumed #{payload}"
  else
    puts "Consumed nothing"
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
bunny-2.17.0 examples/connection/disabled_automatic_recovery.rb
bunny-2.16.1 examples/connection/disabled_automatic_recovery.rb
bunny-2.15.0 examples/connection/disabled_automatic_recovery.rb
bunny-2.14.4 examples/connection/disabled_automatic_recovery.rb
bunny-2.14.3 examples/connection/disabled_automatic_recovery.rb
bunny-2.14.2 examples/connection/disabled_automatic_recovery.rb
bunny-2.14.1 examples/connection/disabled_automatic_recovery.rb
bunny-2.13.0 examples/connection/disabled_automatic_recovery.rb
bunny-2.12.1 examples/connection/disabled_automatic_recovery.rb
bunny-2.12.0 examples/connection/disabled_automatic_recovery.rb
bunny-2.12.0.rc1 examples/connection/disabled_automatic_recovery.rb
bunny-2.11.0 examples/connection/disabled_automatic_recovery.rb