Class: Legion::Extensions::Node::Transport::Messages::Beat
- Inherits:
-
Transport::Message
- Object
- Transport::Message
- Legion::Extensions::Node::Transport::Messages::Beat
- Defined in:
- lib/legion/extensions/node/transport/messages/beat.rb
Instance Method Summary collapse
- #encrypt? ⇒ Boolean
- #expiration ⇒ Object
- #message ⇒ Object
- #routing_key ⇒ Object
- #type ⇒ Object
- #validate ⇒ Object
Instance Method Details
#encrypt? ⇒ Boolean
15 16 17 |
# File 'lib/legion/extensions/node/transport/messages/beat.rb', line 15 def encrypt? false end |
#expiration ⇒ Object
11 12 13 |
# File 'lib/legion/extensions/node/transport/messages/beat.rb', line 11 def expiration 5000 end |
#message ⇒ Object
19 20 21 22 23 |
# File 'lib/legion/extensions/node/transport/messages/beat.rb', line 19 def hash = { hostname: Legion::Settings[:client][:hostname], pid: Process.pid, timestamp: Time.now } hash[:status] = @options[:status].nil? ? 'healthy' : @options[:status] hash end |
#routing_key ⇒ Object
3 4 5 |
# File 'lib/legion/extensions/node/transport/messages/beat.rb', line 3 def routing_key 'health' end |
#type ⇒ Object
7 8 9 |
# File 'lib/legion/extensions/node/transport/messages/beat.rb', line 7 def type 'heartbeat' end |
#validate ⇒ Object
25 26 27 28 29 |
# File 'lib/legion/extensions/node/transport/messages/beat.rb', line 25 def validate raise 'status should be a string' unless @options[:status].is_a?(String) || @options[:status].nil? @valid = true end |