Class: Legion::Extensions::Node::Transport::Messages::Beat

Inherits:
Transport::Message
  • Object
show all
Defined in:
lib/legion/extensions/node/transport/messages/beat.rb

Instance Method Summary collapse

Instance Method Details

#encrypt?Boolean



15
16
17
# File 'lib/legion/extensions/node/transport/messages/beat.rb', line 15

def encrypt?
  false
end

#expirationObject



11
12
13
# File 'lib/legion/extensions/node/transport/messages/beat.rb', line 11

def expiration
  5000
end

#messageObject



19
20
21
22
23
# File 'lib/legion/extensions/node/transport/messages/beat.rb', line 19

def message
  hash = { hostname: Legion::Settings[:client][:hostname], pid: Process.pid, timestamp: Time.now }
  hash[:status] = @options[:status].nil? ? 'healthy' : @options[:status]
  hash
end

#routing_keyObject



3
4
5
# File 'lib/legion/extensions/node/transport/messages/beat.rb', line 3

def routing_key
  'health'
end

#typeObject



7
8
9
# File 'lib/legion/extensions/node/transport/messages/beat.rb', line 7

def type
  'heartbeat'
end

#validateObject



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