Class Node

java.lang.Object
org.apache.kafka.common.Node

public class Node extends Object
Information about a Kafka node
  • Constructor Summary

    Constructors
    Constructor
    Description
    Node(int id, String host, int port)
     
    Node(int id, String host, int port, String rack)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    int
     
    boolean
    True if this node has a defined rack
    The host name for this node
    int
    id()
    The node id of this node
    String representation of the node id.
    boolean
    Check whether this node is empty, which may be the case if noNode() is used as a placeholder in a response payload with an error.
    static Node
     
    int
    The port for this node
    The rack for this node
     

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Node

      public Node(int id, String host, int port)
    • Node

      public Node(int id, String host, int port, String rack)
  • Method Details

    • noNode

      public static Node noNode()
    • isEmpty

      public boolean isEmpty()
      Check whether this node is empty, which may be the case if noNode() is used as a placeholder in a response payload with an error.
      Returns:
      true if it is, false otherwise
    • id

      public int id()
      The node id of this node
    • idString

      public String idString()
      String representation of the node id. Typically the integer id is used to serialize over the wire, the string representation is used as an identifier with NetworkClient code
    • host

      public String host()
      The host name for this node
    • port

      public int port()
      The port for this node
    • hasRack

      public boolean hasRack()
      True if this node has a defined rack
    • rack

      public String rack()
      The rack for this node
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object