use of org.apache.camel.impl.cloud.BlacklistServiceFilter in project camel by apache.
the class CamelCloudServiceFilterAutoConfiguration method serviceFilter.
@Lazy
@Bean(name = "service-filter")
public CamelCloudServiceFilter serviceFilter(CamelCloudConfigurationProperties properties) {
BlacklistServiceFilter blacklist = new BlacklistServiceFilter();
Map<String, List<String>> services = properties.getServiceFilter().getBlacklist();
for (Map.Entry<String, List<String>> entry : services.entrySet()) {
for (String part : entry.getValue()) {
String host = StringHelper.before(part, ":");
String port = StringHelper.after(part, ":");
if (ObjectHelper.isNotEmpty(host) && ObjectHelper.isNotEmpty(port)) {
blacklist.addServer(entry.getKey(), host, Integer.parseInt(port));
}
}
}
return new CamelCloudServiceFilter(Arrays.asList(new HealthyServiceFilter(), blacklist));
}
Aggregations