Search in sources :

Example 1 with RoundRobinServiceChooser

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;
}
Also used : ServiceChooser(org.apache.camel.cloud.ServiceChooser) RoundRobinServiceChooser(org.apache.camel.impl.cloud.RoundRobinServiceChooser) RandomServiceChooser(org.apache.camel.impl.cloud.RandomServiceChooser) RandomServiceChooser(org.apache.camel.impl.cloud.RandomServiceChooser) RoundRobinServiceChooser(org.apache.camel.impl.cloud.RoundRobinServiceChooser)

Aggregations

ServiceChooser (org.apache.camel.cloud.ServiceChooser)1 RandomServiceChooser (org.apache.camel.impl.cloud.RandomServiceChooser)1 RoundRobinServiceChooser (org.apache.camel.impl.cloud.RoundRobinServiceChooser)1