Class NewPartitions


  • public class NewPartitions
    extends Object
    An update to the number of partitions including assignment. Partitions can be increased only. If decrease, an exception from Kafka broker is received. If no assignment is specifies brokers will randomly assign the partitions.
    • Constructor Detail

      • NewPartitions

        public NewPartitions()
        Constructor
      • NewPartitions

        public NewPartitions​(int totalCount,
                             List<List<Integer>> newAssignments)
        Constructor
        Parameters:
        totalCount - total count of partitions
        newAssignments - assignment to the brokers
      • NewPartitions

        public NewPartitions​(JsonObject json)
        Constructor (from JSON representation)
        Parameters:
        json - JSON representation
    • Method Detail

      • NewPartitions

        public void NewPartitions​(int totalCount)
        Constructor
        Parameters:
        totalCount - total count of partitions
      • setTotalCount

        public NewPartitions setTotalCount​(int totalCount)
        Set the number of partitions for the topic
        Parameters:
        totalCount - the number of partitions for the topic
        Returns:
        current instance of the class to be fluent
      • setNewAssignments

        public NewPartitions setNewAssignments​(List<List<Integer>> assignments)
        Set the assignment for the new partitions
        Parameters:
        assignments - assignments of the partitions to the brokers
        Returns:
        current instance of the class to be fluent
      • getTotalCount

        public int getTotalCount()
        Returns:
        number of total partitions
      • getNewAssignments

        public List<List<Integer>> getNewAssignments()
        Returns:
        assignment of partitions to the brokers
      • toJson

        public JsonObject toJson()
        Convert object to JSON representation
        Returns:
        JSON representation