class Tackle::Consumer::MainQueue
Public Class Methods
new(exchange, connection, logger)
click to toggle source
Calls superclass method
Tackle::Consumer::Queue::new
# File lib/tackle/consumer/main_queue.rb, line 5 def initialize(exchange, connection, logger) @exchange = exchange name = @exchange.name options = { :durable => true } super(name, options, connection, logger) bind_to_exchange end
Public Instance Methods
bind_to_exchange()
click to toggle source
# File lib/tackle/consumer/main_queue.rb, line 16 def bind_to_exchange @logger.info("Binding queue '#{name}' to exchange '#{@exchange.name}' with routing_key '#{@exchange.routing_key}'") @amqp_queue.bind(@exchange, :routing_key => @exchange.routing_key) rescue Exception => ex @logger.error "Failed to bind queue to exchange '#{ex}'" raise ex end
subscribe(&block)
click to toggle source
# File lib/tackle/consumer/main_queue.rb, line 25 def subscribe(&block) options = { :manual_ack => true, :block => true } @amqp_queue.subscribe(options) do |delivery_info, properties, payload| message = Message.new(@connection, @logger, delivery_info, properties, payload) block.call(message) end end