Class: Freddy::Adapters::MarchHareAdapter::Channel

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

Constant Summary collapse

NO_ROUTE =
312

Instance Method Summary collapse

Constructor Details

#initialize(channel) ⇒ Channel

Returns a new instance of Channel.



30
31
32
# File 'lib/freddy/adapters/march_hare_adapter.rb', line 30

def initialize(channel)
  @channel = channel
end

Instance Method Details

#on_no_route(&block) ⇒ Object



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

def on_no_route(&block)
  @channel.on_return do |reply_code, _, exchange_name, _, properties|
    if exchange_name != Freddy::FREDDY_TOPIC_EXCHANGE_NAME && reply_code == NO_ROUTE
      block.call(properties.correlation_id)
    end
  end
end

#queue(*args) ⇒ Object



36
37
38
# File 'lib/freddy/adapters/march_hare_adapter.rb', line 36

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