Sha256: f7856f07cbaae0fc6650b31a0c690249f52fcbaa1922363e24c3248c7df1bcb0

Contents?: true

Size: 633 Bytes

Versions: 8

Compression:

Stored size: 633 Bytes

Contents

module Legion::Extensions::Node::Transport::Messages
  class Beat < Legion::Transport::Message
    def routing_key
      'health'
    end

    def type
      'heartbeat'
    end

    def expiration
      5000
    end

    def encrypt?
      false
    end

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

    def validate
      raise 'status should be a string' unless @options[:status].is_a?(String) || @options[:status].nil?

      @valid = true
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
lex-node-0.1.7 lib/legion/extensions/node/transport/messages/beat.rb
lex-node-0.1.6 lib/legion/extensions/node/transport/messages/beat.rb
lex-node-0.1.5 lib/legion/extensions/node/transport/messages/beat.rb
lex-node-0.1.4 lib/legion/extensions/node/transport/messages/beat.rb
lex-node-0.1.3 lib/legion/extensions/node/transport/messages/beat.rb
lex-node-0.1.2 lib/legion/extensions/node/transport/messages/beat.rb
lex-node-0.1.1 lib/legion/extensions/node/transport/messages/beat.rb
lex-node-0.1.0 lib/legion/extensions/node/transport/messages/beat.rb