Class: Gorgon::AmqpService

Inherits:
Object
  • Object
show all
Defined in:
lib/gorgon/amqp_service.rb

Instance Method Summary collapse

Constructor Details

#initialize(connection_config) ⇒ AmqpService

Returns a new instance of AmqpService.



29
30
31
# File 'lib/gorgon/amqp_service.rb', line 29

def initialize connection_config
  @connection_config = connection_config.merge(:spec => "09")
end

Instance Method Details

#start_worker(file_queue_name, reply_exchange_name) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/gorgon/amqp_service.rb', line 33

def start_worker file_queue_name, reply_exchange_name
  GorgonBunny.run @connection_config do |b|
    queue = b.queue(file_queue_name, :auto_delete => true)
    exchange = b.exchange(reply_exchange_name, :auto_delete => true)
    yield AmqpQueueDecorator.new(queue), AmqpExchangeDecorator.new(exchange)
  end
end