Sha256: ac118372237277258cf8dd2f4856ceb7d8a5468d5bca2b34564af9533402c8f4
Contents?: true
Size: 862 Bytes
Versions: 26
Compression:
Stored size: 862 Bytes
Contents
require 'gorgon_bunny/lib/gorgon_bunny' require 'yajl' class AmqpQueueDecorator def initialize queue @queue = queue end def pop m = @queue.pop payload = m[2] return payload end end class AmqpExchangeDecorator def initialize exchange @exchange = exchange end def publish msg serialized_msg = Yajl::Encoder.encode(msg) @exchange.publish serialized_msg end end class AmqpService def initialize connection_config @connection_config = connection_config.merge(:spec => "09") end 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 end
Version data entries
26 entries across 26 versions & 1 rubygems