io.vertx.kafka.client.common

## Class TopicPartitionInfo

- java.lang.Object
- - io.vertx.kafka.client.common.TopicPartitionInfo

-     public class TopicPartitionInfo
      extends Object

  A class containing leadership, replicas and ISR information for a topic partition.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TopicPartitionInfo()` Constructor
    `TopicPartitionInfo(JsonObject json)` Constructor (from JSON representation)
    `TopicPartitionInfo(List<Node> isr, Node leader, int partition, List<Node> replicas)` Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `List<Node>` | `getIsr()`
    `Node` | `getLeader()`
    `int` | `getPartition()`
    `List<Node>` | `getReplicas()`
    `TopicPartitionInfo` | `setIsr(List<Node> isr)` Set the subset of the replicas that are in sync
    `TopicPartitionInfo` | `setLeader(Node leader)` Set the node id of the node currently acting as a leader
    `TopicPartitionInfo` | `setPartition(int partition)` Set the partition id
    `TopicPartitionInfo` | `setReplicas(List<Node> replicas)` Set the complete set of replicas for this partition
    `JsonObject` | `toJson()` Convert object to JSON representation
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### TopicPartitionInfo

          public TopicPartitionInfo()

      Constructor

    - #### TopicPartitionInfo

          public TopicPartitionInfo(List<Node> isr,
                                    Node leader,
                                    int partition,
                                    List<Node> replicas)

      Constructor
      Parameters:
        `isr` - the subset of the replicas that are in sync
        `leader` - the node id of the node currently acting as a leader
        `partition` - the partition id
        `replicas` - the complete set of replicas for this partition

    - #### TopicPartitionInfo

          public TopicPartitionInfo(JsonObject json)

      Constructor (from JSON representation)
      Parameters:
        `json` - JSON representation

  - ### Method Detail

    - #### getIsr

          public List<Node> getIsr()

      Returns:
        the subset of the replicas that are in sync, that is caught-up to the leader and ready to take over as leader if the leader should fail

    - #### setIsr

          public TopicPartitionInfo setIsr(List<Node> isr)

      Set the subset of the replicas that are in sync
      Parameters:
        `isr` - the subset of the replicas that are in sync
      Returns:
        current instance of the class to be fluent

    - #### getLeader

          public Node getLeader()

      Returns:
        the node id of the node currently acting as a leader for this partition or null if there is no leader

    - #### setLeader

          public TopicPartitionInfo setLeader(Node leader)

      Set the node id of the node currently acting as a leader
      Parameters:
        `leader` - the node id of the node currently acting as a leader
      Returns:
        current instance of the class to be fluent

    - #### getPartition

          public int getPartition()

      Returns:
        the partition id

    - #### setPartition

          public TopicPartitionInfo setPartition(int partition)

      Set the partition id
      Parameters:
        `partition` - the partition id
      Returns:
        current instance of the class to be fluent

    - #### getReplicas

          public List<Node> getReplicas()

      Returns:
        the complete set of replicas for this partition regardless of whether they are alive or up-to-date

    - #### setReplicas

          public TopicPartitionInfo setReplicas(List<Node> replicas)

      Set the complete set of replicas for this partition
      Parameters:
        `replicas` - the complete set of replicas for this partition
      Returns:
        current instance of the class to be fluent

    - #### toJson

          public JsonObject toJson()

      Convert object to JSON representation
      Returns:
        JSON representation

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2021 Eclipse. All rights reserved.