Ich erstelle Partition für ein Thema dynamisch mit AdminUtils. Ich muss die PartitionId der neu erstellten Partition abrufen, um sie in Mysql für meine Geschäftslogik zu speichern. Wie kann ich das erreichen? Mein aktueller Code:Kafka, wie die neueste erstellte Partition ID für ein Thema in Java zu kennen ist
AdminUtils.addPartitions(zkUtils,KAFKA_PRODUCER_TOPIC,currentPartitionCount+1,"",true);
List<PartitionInfo> infoList = producer.partitionsFor(KAFKA_PRODUCER_TOPIC);
for(PartitionInfo info : infoList){
System.out.println(info.partition());
}
createdPartionId = infoList.get(0).partition();
Problem oben ist, dass letzte erstellte Partition nicht in der Partition Liste kommt. Ich weiß nicht warum. Producer ist die Kafka Producer API.