pl.allegro.tech.hermes.consumers.config.ZookeeperClustersProperties 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.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import pl.allegro.tech.hermes.infrastructure.dc.DatacenterNameProvider;
import java.util.ArrayList;
import java.util.List;
@ConfigurationProperties(prefix = "consumer.zookeeper")
public class ZookeeperClustersProperties {
private List clusters = new ArrayList<>();
public List getClusters() {
return clusters;
}
public void setClusters(List clusters) {
this.clusters = clusters;
}
public ZookeeperProperties toZookeeperProperties(DatacenterNameProvider datacenterNameProvider) {
return this.clusters
.stream()
.filter(cluster -> cluster.getDatacenter().equals(datacenterNameProvider.getDatacenterName()))
.findFirst()
.orElseThrow(() -> new IllegalArgumentException(
"No properties for datacenter: " + datacenterNameProvider.getDatacenterName() + " defined."));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy