Sha256: c2124c267d7e55f431a37f25d399bcc042aad057b09708d17affc4fa8186022d

Contents?: true

Size: 629 Bytes

Versions: 1

Compression:

Stored size: 629 Bytes

Contents

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

    def type
      'heartbeat'
    end

    def expiration
      5000
    end

    def encrypt?
      false
    end

    def message
      hash = { name: 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

1 entries across 1 versions & 1 rubygems

Version Path
lex-node-0.2.0 lib/legion/extensions/node/transport/messages/beat.rb