Class: Freddy::Adapters::BunnyAdapter::Channel

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/freddy/adapters/bunny_adapter.rb

Constant Summary collapse

NO_ROUTE =
312

Instance Method Summary collapse

Constructor Details

#initialize(channel) ⇒ Channel

Returns a new instance of Channel.



31
32
33
# File 'lib/freddy/adapters/bunny_adapter.rb', line 31

def initialize(channel)
  @channel = channel
end

Instance Method Details

#on_no_route(&block) ⇒ Object



41
42
43
44
45
46
47
# File 'lib/freddy/adapters/bunny_adapter.rb', line 41

def on_no_route(&block)
  default_exchange.on_return do |return_info, properties, content|
    if return_info[:reply_code] == NO_ROUTE
      block.call(properties[:correlation_id])
    end
  end
end

#queue(*args) ⇒ Object



37
38
39
# File 'lib/freddy/adapters/bunny_adapter.rb', line 37

def queue(*args)
  Queue.new(@channel.queue(*args))
end