Sha256: 837bf05ea0b894dd3f9597e4fa80090e359e3755b0185073166dc5b852b272a2

Contents?: true

Size: 665 Bytes

Versions: 3

Compression:

Stored size: 665 Bytes

Contents

# frozen_string_literal: true

module Orchestration
  module Services
    module RabbitMQ
      class Healthcheck
        include HealthcheckBase

        dependencies 'bunny'

        def connection_errors
          [
            Bunny::TCPConnectionFailedForAllHosts,
            AMQ::Protocol::EmptyResponseError
          ]
        end

        def connect
          port = @configuration.local_port

          connection = Bunny.new("amqp://localhost:#{port}", log_file: devnull)
          connection.start
          connection.stop
        end

        private

        def devnull
          File.open(File::NULL, 'w')
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
orchestration-0.2.6 lib/orchestration/services/rabbitmq/healthcheck.rb
orchestration-0.2.5 lib/orchestration/services/rabbitmq/healthcheck.rb
orchestration-0.2.4 lib/orchestration/services/rabbitmq/healthcheck.rb