Sha256: b6815534a70197573c53ad6a80622fe66ec2d7c5a9f6719b6263319086f374f6
Contents?: true
Size: 636 Bytes
Versions: 12
Compression:
Stored size: 636 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("", :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 2 data = rand.to_s rk = ["abc", "def"].sample puts "Published #{data}, routing key: #{rk}" x.publish(data, :routing_key => rk) end
Version data entries
12 entries across 12 versions & 1 rubygems