X-Git-Url: https://juplo.de/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Fmain%2Fjava%2Fde%2Fjuplo%2Fkafka%2FStateDocument.java;fp=src%2Fmain%2Fjava%2Fde%2Fjuplo%2Fkafka%2FStateDocument.java;h=52968cdb5912f85fef4cf59c8b426424eeca54d9;hb=5f35354fd694f78599d66ee9e01fb4c0d89cc5bb;hp=0000000000000000000000000000000000000000;hpb=c808810e9e33afe33b29f7fd3921023ecd15483d;p=demos%2Fkafka%2Ftraining diff --git a/src/main/java/de/juplo/kafka/StateDocument.java b/src/main/java/de/juplo/kafka/StateDocument.java new file mode 100644 index 0000000..52968cd --- /dev/null +++ b/src/main/java/de/juplo/kafka/StateDocument.java @@ -0,0 +1,42 @@ +package de.juplo.kafka; + +import lombok.ToString; +import org.springframework.data.annotation.Id; +import org.springframework.data.mongodb.core.mapping.Document; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +@Document(collection = "statistics") +@ToString +public class StateDocument +{ + @Id + public String id; + public long offset = -1l; + public Map state; + public Map> seen; + + public StateDocument() + { + } + + public StateDocument(Integer partition) + { + this.id = Integer.toString(partition); + this.state = new HashMap<>(); + this.seen = new HashMap<>(); + } + + public StateDocument( + Integer partition, + Map state, + Map> seen) + { + this.id = Integer.toString(partition); + this.state = state; + this.seen = seen; + } +}