Sha256: f8d4301b7c69ef37dd915a3440b64ce3fc4f9c01392397692a13c18ec8931be4

Contents?: true

Size: 633 Bytes

Versions: 1

Compression:

Stored size: 633 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_interval => 8)
conn.start

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

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

q.subscribe do |delivery_info, metadata, payload|
  puts "Consumed #{payload}"
end

loop do
  sleep 3
  puts "Tick"
  x.publish(rand.to_s, :routing_key => ["abc", "def", "ghi", "xyz"].sample)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bunny-0.9.0.pre6 examples/connection/automatic_recovery_with_client_named_queues.rb