Sha256: 76057a0bc75345289ad71b61587d2b0df3299c2149bb49c275112f391f34893e
Contents?: true
Size: 907 Bytes
Versions: 1
Compression:
Stored size: 907 Bytes
Contents
module Msgr class Binding include Logging attr_reader :queue, :subscription, :connection, :route, :dispatcher def initialize(connection, route, dispatcher) @connection = connection @route = route @dispatcher = dispatcher @queue = connection.queue(route.name) route.keys.each do |key| log(:debug) { "Bind #{key} to #{queue.name}." } queue.bind connection.exchange, routing_key: key end @subscription = queue.subscribe(ack: true) do |*args| begin dispatcher.call Message.new(self, *args, route) rescue => err log(:error) do "Rescued error from subscribe: #{err.class.name}: #{err}\n#{err.backtrace.join("\n")}" end end end end def release subscription.cancel end def delete release queue.delete end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
msgr-0.10.0 | lib/msgr/binding.rb |