X-Git-Url: http://juplo.de/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fde%2Fjuplo%2Fkafka%2FStatisticsDocument.java;h=28264ecb62f5280a25880a177d9b8af22355e9bb;hb=34d37c55d7cf830c6d2bdaf747f0938eb557bef3;hp=9318c4cc7137db20024d7bd1943c6fa35ae3b4b9;hpb=915674ec49ba38b3716cc4ef53272e963f139677;p=demos%2Fkafka%2Ftraining diff --git a/src/main/java/de/juplo/kafka/StatisticsDocument.java b/src/main/java/de/juplo/kafka/StatisticsDocument.java index 9318c4c..28264ec 100644 --- a/src/main/java/de/juplo/kafka/StatisticsDocument.java +++ b/src/main/java/de/juplo/kafka/StatisticsDocument.java @@ -14,26 +14,23 @@ public class StatisticsDocument { @Id public String id; - public String topic; - public Integer partition; + public long offset; public Map statistics; public StatisticsDocument() { } - public StatisticsDocument(String topic, Integer partition, Map statistics) + public StatisticsDocument(Integer partition) { - this.partition = partition; - this.statistics = statistics; + this.id = Integer.toString(partition); + this.statistics = new HashMap<>(); } - public StatisticsDocument(PartitionStatistics statistics) + public StatisticsDocument(Integer partition, Map statistics, long offset) { - this.topic = statistics.getPartition().topic(); - this.id = statistics.toString(); - this.partition = statistics.getPartition().partition(); - this.statistics = new HashMap<>(); - statistics.getStatistics().forEach(counter -> this.statistics.put(counter.getKey(), counter.getResult())); + this.id = Integer.toString(partition); + this.statistics = statistics; + this.offset = offset; } }