Class: Artery::WorkerHealthzSubscription
- Inherits:
-
Object
- Object
- Artery::WorkerHealthzSubscription
- Defined in:
- lib/artery/worker_healthz_subscription.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(id, name) ⇒ WorkerHealthzSubscription
constructor
A new instance of WorkerHealthzSubscription.
- #subscribe ⇒ Object
Constructor Details
#initialize(id, name) ⇒ WorkerHealthzSubscription
Returns a new instance of WorkerHealthzSubscription.
7 8 9 10 |
# File 'lib/artery/worker_healthz_subscription.rb', line 7 def initialize(id, name) @id = id @name = name end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/artery/worker_healthz_subscription.rb', line 5 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/artery/worker_healthz_subscription.rb', line 5 def name @name end |
Instance Method Details
#subscribe ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/artery/worker_healthz_subscription.rb', line 12 def subscribe healthz_route = "#{Artery.service_name}.healthz.#{name}" Artery.logger.debug "Subscribing on '#{healthz_route}' for #{name} #{id}" Artery.subscribe healthz_route do |data, reply, _from| next unless data['id'] == id Artery.publish reply, status: :ok end end |