Sha256: 451d31aa8ee1cc490b390a3965a239180671401de88ee6376e17400fb25393b6
Contents?: true
Size: 682 Bytes
Versions: 15
Compression:
Stored size: 682 Bytes
Contents
module RabbitFeed class Connection include Singleton 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 attr_reader :channel, :mutex def synchronized &block mutex.synchronize do yield end end def connection_in_use? mutex.locked? end end end
Version data entries
15 entries across 15 versions & 1 rubygems