Sha256: d98ab6c0684a165ad41d948d9eb51e78f32c7e4350e41318656937f437b7e0e5
Contents?: true
Size: 741 Bytes
Versions: 2
Compression:
Stored size: 741 Bytes
Contents
require 'bunny' module Waffle module Strategies class Rabbitmq def initialize(configuration = nil) raise ArgumentError unless configuration && configuration.is_a?(Waffle::Configuration) @bunny = Bunny.new configuration.url @bunny.start 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 Waffle::Utils.decode(message[:payload]) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
waffle-0.1.3 | lib/waffle/strategies/rabbitmq.rb |
waffle-0.1.2 | lib/waffle/strategies/rabbitmq.rb |