use of org.apache.camel.builder.DefaultFluentProducerTemplate in project camel by apache.
the class AbstractCamelFluentProducerTemplateFactoryBean method getObject.
public FluentProducerTemplate getObject() throws Exception {
CamelContext context = getCamelContext();
if (defaultEndpoint != null) {
Endpoint endpoint = context.getEndpoint(defaultEndpoint);
if (endpoint == null) {
throw new IllegalArgumentException("No endpoint found for URI: " + defaultEndpoint);
} else {
template = new DefaultFluentProducerTemplate(context);
template.setDefaultEndpoint(endpoint);
}
} else {
template = new DefaultFluentProducerTemplate(context);
}
// set custom cache size if provided
if (maximumCacheSize != null) {
template.setMaximumCacheSize(maximumCacheSize);
}
// must start it so its ready to use
ServiceHelper.startService(template);
return template;
}
use of org.apache.camel.builder.DefaultFluentProducerTemplate in project camel by apache.
the class DefaultCamelContext method createFluentProducerTemplate.
public FluentProducerTemplate createFluentProducerTemplate(int maximumCacheSize) {
DefaultFluentProducerTemplate answer = new DefaultFluentProducerTemplate(this);
answer.setMaximumCacheSize(maximumCacheSize);
// start it so its ready to use
try {
startService(answer);
} catch (Exception e) {
throw ObjectHelper.wrapRuntimeCamelException(e);
}
return answer;
}
use of org.apache.camel.builder.DefaultFluentProducerTemplate in project camel by apache.
the class CamelPostProcessorHelper method createInjectionFluentProducerTemplate.
/**
* Factory method to create a
* {@link org.apache.camel.FluentProducerTemplate} to be injected into a
* POJO
*/
protected FluentProducerTemplate createInjectionFluentProducerTemplate(String endpointUri, String endpointRef, String endpointProperty, String injectionPointName, Object bean) {
// endpoint is optional for this injection point
Endpoint endpoint = getEndpointInjection(bean, endpointUri, endpointRef, endpointProperty, injectionPointName, false);
CamelContext context = endpoint != null ? endpoint.getCamelContext() : getCamelContext();
FluentProducerTemplate answer = new DefaultFluentProducerTemplate(context);
answer.setDefaultEndpoint(endpoint);
// start the template so its ready to use
try {
// no need to defer the template as it can adjust to the endpoint at runtime
startService(answer, context, bean, null);
} catch (Exception e) {
throw ObjectHelper.wrapRuntimeCamelException(e);
}
return answer;
}
Aggregations