Sha256: adc5b9cf0602aed499cdb5d27d81eff81050ce8663d0307da15296fc36dbe744

Contents?: true

Size: 728 Bytes

Versions: 2

Compression:

Stored size: 728 Bytes

Contents

require 'telemetry/amqp/version'
require 'telemetry/logger'
require 'telemetry/amqp/base'

module Telemetry
  module AMQP
    class << self
      def connect!(**opts)
        @connection = Telemetry::AMQP::Base.new(**opts)
        @connection.connect!

        @connection
      end

      def connection
        return @connection unless @connection.nil?

        nil
      end

      def session
        @connection&.session
      end

      def channel
        return nil if session.nil?

        session.channel
      end

      def create_channel(consumer_pool_size: 1, abort_on_exception: false, timeout: 30)
        session.create_channel(nil, consumer_pool_size, abort_on_exception, timeout)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
telemetry-amqp-0.2.0 lib/telemetry/amqp.rb
telemetry-amqp-0.1.0 lib/telemetry/amqp.rb