Class: Orchestration::Services::RabbitMQ::Healthcheck

Inherits:
Object
  • Object
show all
Includes:
HealthcheckBase
Defined in:
lib/orchestration/services/rabbitmq/healthcheck.rb

Instance Attribute Summary

Attributes included from HealthcheckBase

#configuration

Instance Method Summary collapse

Methods included from HealthcheckBase

included

Constructor Details

#initialize(env) ⇒ Healthcheck

Returns a new instance of Healthcheck.



9
10
11
# File 'lib/orchestration/services/rabbitmq/healthcheck.rb', line 9

def initialize(env)
  @configuration = Configuration.new(env)
end

Instance Method Details

#connectObject



20
21
22
23
24
25
26
27
# File 'lib/orchestration/services/rabbitmq/healthcheck.rb', line 20

def connect
  host = @configuration.settings.fetch('host')
  port = @configuration.settings.fetch('port')

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

#connection_errorsObject



13
14
15
16
17
18
# File 'lib/orchestration/services/rabbitmq/healthcheck.rb', line 13

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