class ActivePublisher::Async::InMemoryAdapter::Channel

This class is a wrapper around bunny and march hare channels to cache exchanges. Bunny does this by default, but march hare will perform a blocking wait for each exchange declaration.

Attributes

rabbit_channel[R]
topic_exchange_cache[R]

Public Class Methods

new() click to toggle source
# File lib/active_publisher/async/in_memory_adapter/channel.rb, line 12
def initialize
  @topic_exchange_cache = {}
  @rabbit_channel = ::ActivePublisher::Connection.connection.create_channel
end

Public Instance Methods

close() click to toggle source
# File lib/active_publisher/async/in_memory_adapter/channel.rb, line 17
def close
  rabbit_channel.close
end
confirm_select() click to toggle source
# File lib/active_publisher/async/in_memory_adapter/channel.rb, line 21
def confirm_select
  rabbit_channel.confirm_select
end
topic(exchange) click to toggle source
# File lib/active_publisher/async/in_memory_adapter/channel.rb, line 25
def topic(exchange)
  topic_exchange_cache[exchange] ||= rabbit_channel.topic(exchange)
end
using_publisher_confirms?() click to toggle source
# File lib/active_publisher/async/in_memory_adapter/channel.rb, line 29
def using_publisher_confirms?
  rabbit_channel.using_publisher_confirms?
end
wait_for_confirms(timeout) click to toggle source
# File lib/active_publisher/async/in_memory_adapter/channel.rb, line 33
def wait_for_confirms(timeout)
  if rabbit_channel.method(:wait_for_confirms).arity > 0
    rabbit_channel.wait_for_confirms(timeout)
  else
    rabbit_channel.wait_for_confirms
  end
end