in components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelProxyFactoryBean.java [91:127]
public void afterPropertiesSet() throws Exception {
if (endpoint == null) {
getCamelContext();
if (getServiceUrl() == null && getServiceRef() == null) {
throw new IllegalArgumentException("serviceUrl or serviceRef must be specified.");
}
if (getServiceInterface() == null) {
throw new IllegalArgumentException("serviceInterface must be specified.");
}
// lookup endpoint or we have the url for it
if (getServiceRef() != null) {
endpoint = getCamelContext().getRegistry().lookupByNameAndType(getServiceRef(), Endpoint.class);
} else {
endpoint = getCamelContext().getEndpoint(getServiceUrl());
}
if (endpoint == null) {
throw new IllegalArgumentException("Could not resolve endpoint: " + getServiceUrl());
}
}
// binding is enabled by default
boolean bind = getBinding() != null ? getBinding() : true;
try {
// need to start endpoint before we create producer
ServiceHelper.startService(endpoint);
producer = endpoint.createProducer();
// add and start producer
getCamelContext().addService(producer, true, true);
Class<?> clazz = blueprintContainer.loadClass(getServiceInterface());
serviceProxy = ProxyHelper.createProxy(endpoint, bind, producer, clazz);
} catch (Exception e) {
throw new FailedToCreateProducerException(endpoint, e);
}
}