Sha256: 5ece8ce2b07574fd65484bf942836e8c7e0c9179661f0c4fe15d1ff4bdfd7ac7

Contents?: true

Size: 783 Bytes

Versions: 3

Compression:

Stored size: 783 Bytes

Contents

# monkey patch to the amqp gem that adds :no_declare => true option for new 
# Exchange objects. This allows us to send messeages to exchanges that are
# declared by the mappers and that we have no configuration priviledges on.
# temporary until we get this into amqp proper
MQ::Exchange.class_eval do
  def initialize mq, type, name, opts = {}
    @mq = mq
    @type, @name, @opts = type, name, opts
    @mq.exchanges[@name = name] ||= self
    @key = opts[:key]

    @mq.callback{
      @mq.send AMQP::Protocol::Exchange::Declare.new({ :exchange => name,
                                                 :type => type,
                                                 :nowait => true }.merge(opts))
    } unless name == "amq.#{type}" or name == ''  or opts[:no_declare]
  end
end

Version data entries

3 entries across 3 versions & 3 rubygems

Version Path
donkey-0.1.0 lib/ass/amqp.rb
ASS-0.1.0 lib/ass/amqp.rb
jamesgolick-ASS-0.1.0 lib/ass/amqp.rb