don't create dead-letter queues when tracing
MODIFY
lib/beetle/client.rb
lib/beetle/client.rb
@@ -275,7 +275,9 @@ module Beetle
puts "DATA: #{msg.data}"
end
register_handler(queue_names){|msg| tracer.call msg }
+ @subscriber.tracing = true
listen_queues(queue_names, &block)
+ @subscriber.tracing = false
end
# evaluate the ruby files matching the given +glob+ pattern in the context of the client instance.

MODIFY
lib/beetle/subscriber.rb
lib/beetle/subscriber.rb
@@ -4,6 +4,11 @@ module Beetle
# Manages subscriptions and message processing on the receiver side of things.
class Subscriber < Base
+ attr_accessor :tracing
+ def tracing?
+ @tracing
+ end
+
# create a new subscriber instance
def initialize(client, options = {}) #:nodoc:
super
@@ -14,6 +19,7 @@ module Beetle
@subscriptions = {}
@listened_queues = []
@channels_closed = false
+ @tracing = false
end
# the client calls this method to subscribe to a list of queues.
@@ -206,8 +212,11 @@ module Beetle
def bind_queue!(queue_name, creation_keys, exchange_name, binding_keys)
queue = channel.queue(queue_name, creation_keys)
+ unless tracing?
+ # we don't want to create dead-letter queues for tracing
policy_options = bind_dead_letter_queue!(channel, queue_name, creation_keys)
publish_policy_options(policy_options)
+ end
exchange = exchange(exchange_name)
queue.bind(exchange, binding_keys)
queue

don't create dead-letter queues when tracing