Class: Sonic::Protocol::AMQP
- Inherits:
-
Object
- Object
- Sonic::Protocol::AMQP
- Includes:
- Base
- Defined in:
- lib/sonic/protocols/amqp.rb
Instance Method Summary collapse
- #check ⇒ Object
-
#initialize(service_checker) ⇒ AMQP
constructor
A new instance of AMQP.
Constructor Details
#initialize(service_checker) ⇒ AMQP
Returns a new instance of AMQP.
8 9 10 |
# File 'lib/sonic/protocols/amqp.rb', line 8 def initialize(service_checker) @service_checker = service_checker end |
Instance Method Details
#check ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/sonic/protocols/amqp.rb', line 12 def check begin conn = ::Bunny.new(:host => @service_checker.host, :port => @service_checker.port, :username => @service_checker.username, :password => @service_checker.password, :vhost => @service_checker.vhost) conn.start @service_checker.response = conn.status if @service_checker.response == :open true else @service_checker.error = "service error" false end conn.close rescue Exception => e @service_checker.error = e.to_s false end end |