use of org.apache.camel.impl.cloud.DefaultServiceCallProcessor in project camel by apache.
the class ServiceCallDefinition method createProcessor.
// *****************************
// Processor Factory
// *****************************
@Override
public Processor createProcessor(RouteContext routeContext) throws Exception {
final CamelContext camelContext = routeContext.getCamelContext();
final ServiceDiscovery serviceDiscovery = retrieveServiceDiscovery(camelContext);
final ServiceFilter serviceFilter = retrieveServiceFilter(camelContext);
final ServiceChooser serviceChooser = retrieveServiceChooser(camelContext);
final LoadBalancer loadBalancer = retrieveLoadBalancer(camelContext);
final Expression expression = retrieveExpression(camelContext);
if (loadBalancer instanceof CamelContextAware) {
((CamelContextAware) loadBalancer).setCamelContext(camelContext);
}
if (loadBalancer instanceof ServiceDiscoveryAware) {
((ServiceDiscoveryAware) loadBalancer).setServiceDiscovery(serviceDiscovery);
}
if (loadBalancer instanceof ServiceFilterAware) {
((ServiceFilterAware) loadBalancer).setServiceFilter(serviceFilter);
}
if (loadBalancer instanceof ServiceChooserAware) {
((ServiceChooserAware) loadBalancer).setServiceChooser(serviceChooser);
}
// The component is used to configure the default scheme to use (eg camel component name).
// The component configured on EIP takes precedence vs configured on configuration.
String component = this.component;
if (component == null) {
ServiceCallConfigurationDefinition conf = retrieveConfig(camelContext);
if (conf != null) {
component = conf.getComponent();
}
}
if (component == null) {
ServiceCallConfigurationDefinition conf = retrieveDefaultConfig(camelContext);
if (conf != null) {
component = conf.getComponent();
}
}
return new DefaultServiceCallProcessor(camelContext, name, component, uri, pattern, loadBalancer, expression);
}
Aggregations