use of org.apache.camel.impl.cloud.RoundRobinServiceChooser in project camel by apache.
the class ServiceCallDefinition method retrieveServiceChooser.
// ******************************************
// ServiceChooser
// ******************************************
private ServiceChooser retrieveServiceChooser(CamelContext camelContext, Function<CamelContext, ServiceCallConfigurationDefinition> function) throws Exception {
ServiceChooser answer = null;
ServiceCallConfigurationDefinition config = function.apply(camelContext);
if (config != null) {
answer = retrieve(ServiceChooser.class, camelContext, config::getServiceChooser, config::getServiceChooserRef);
if (answer == null) {
String ref = config.getServiceChooserRef();
if (ObjectHelper.equal("roundrobin", ref, true)) {
answer = new RoundRobinServiceChooser();
} else if (ObjectHelper.equal("round-robin", ref, true)) {
answer = new RoundRobinServiceChooser();
} else if (ObjectHelper.equal("random", ref, true)) {
answer = new RandomServiceChooser();
}
}
}
return answer;
}
Aggregations