Sha256: 71588fcd5ebddfba9687c0f29f7ed377ea3a079459c898b0b03292f0d7a51558
Contents?: true
Size: 732 Bytes
Versions: 2
Compression:
Stored size: 732 Bytes
Contents
require 'bunny' module Waffle module Transports class Rabbitmq def initialize @bunny = Bunny.new Waffle::Config.url @bunny.start end def encoder @encoder ||= eval("Waffle::Encoders::#{Waffle::Config.encoder.capitalize}") end def publish(flow = 'events', message = '') @exchange = @bunny.exchange flow @exchange.publish message end def subscribe(flow = 'events') @exchange = @bunny.exchange flow @queue = @bunny.queue '', :durable => true, :auto_delete => true @queue.bind @exchange @queue.subscribe do |message| yield encoder.decode(message[:payload]) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
waffle-0.2.2 | lib/waffle/transports/rabbitmq.rb |
waffle-0.2.1 | lib/waffle/transports/rabbitmq.rb |