class RabbitFeed::Connection

Attributes

channel[R]
mutex[R]

Public Class Methods

new() click to toggle source
# File lib/rabbit_feed/connection.rb, line 5
def initialize
  RabbitFeed.log.info { { event: :connecting_to_rabbitmq, options: RabbitFeed.configuration.connection_options.merge(password: :redacted, logger: :redacted) } }
  @connection = Bunny.new RabbitFeed.configuration.connection_options
  @connection.start
  RabbitFeed.log.info { { event: :connected_to_rabbitmq } }
  @channel = @connection.create_channel
  @mutex = Mutex.new
end

Private Instance Methods

connection_in_use?() click to toggle source
# File lib/rabbit_feed/connection.rb, line 24
def connection_in_use?
  mutex.locked?
end
synchronized() { || ... } click to toggle source
# File lib/rabbit_feed/connection.rb, line 18
def synchronized
  mutex.synchronize do
    yield
  end
end