pl.allegro.tech.hermes.consumers.consumer.offset.OffsetsToCommit Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hermes-consumers Show documentation
Show all versions of hermes-consumers Show documentation
Fast and reliable message broker built on top of Kafka.
package pl.allegro.tech.hermes.consumers.consumer.offset;
import pl.allegro.tech.hermes.api.SubscriptionName;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
public class OffsetsToCommit {
private final Map> offsets = new HashMap<>();
public OffsetsToCommit add(SubscriptionPartitionOffset offset) {
Set subscriptionOffsets = offsets.get(offset.getSubscriptionName());
if(subscriptionOffsets == null) {
subscriptionOffsets = new HashSet<>();
offsets.put(offset.getSubscriptionName(), subscriptionOffsets);
}
subscriptionOffsets.add(offset);
return this;
}
public Set subscriptionNames() {
return offsets.keySet();
}
public Set batchFor(SubscriptionName subscriptionName) {
return offsets.get(subscriptionName);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy