class Rack::Healthcheck::Checks::RabbitMQ

Attributes

config[R]

Public Class Methods

new(name, config) click to toggle source

@param name [String] @param config [Hash<Symbol,Object>] Hash with configs @example name = RabbitMQ config = {

hosts: [localhost],
port: 5672,
user: guest,
pass: guest,
optional: true

}

Calls superclass method Rack::Healthcheck::Checks::Base::new
# File lib/rack/healthcheck/checks/rabbit_mq.rb, line 21
def initialize(name, config)
  super(name, Rack::Healthcheck::Type::MESSAGING, config[:optional], config[:hosts])
  @config = config
end

Private Instance Methods

check() click to toggle source
# File lib/rack/healthcheck/checks/rabbit_mq.rb, line 28
def check
  connection = Bunny.new(config)
  connection.start
  connection.close
  @status = true
rescue StandardError => _
  @status = false
end