Class: 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.



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

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

Instance Method Details

#start_worker(file_queue_name, reply_exchange_name) ⇒ Object



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

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