Package org.apache.camel.impl.engine
Class DefaultFluentProducerTemplate
java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.impl.engine.DefaultFluentProducerTemplate
- All Implemented Interfaces:
AutoCloseable,org.apache.camel.FluentProducerTemplate,org.apache.camel.Service,org.apache.camel.ShutdownableService,org.apache.camel.StatefulService,org.apache.camel.SuspendableService
public class DefaultFluentProducerTemplate
extends org.apache.camel.support.service.ServiceSupport
implements org.apache.camel.FluentProducerTemplate
This implementation is based on the usage pattern, that a top level DefaultFluentProducerTemplate instance is created
as singleton and provided to the Camel end user (such as injected into a POJO).
The top level instance is then cloned once per message that is being built using the fluent method calls and then reset when the message has been sent.
Each cloned instance is not thread-safe as its assumed that its a single thread that calls the fluent method to build up the message to be sent.
-
Field Summary
Fields inherited from class org.apache.camel.support.service.BaseService
BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> Future<T>asyncRequest(Class<T> type) Future<org.apache.camel.Exchange>voidcleanUp()protected voiddoInit()protected voidprotected voiddoStart()protected voiddoStop()org.apache.camel.CamelContextintorg.apache.camel.Endpointintbooleanstatic org.apache.camel.FluentProducerTemplateon(org.apache.camel.CamelContext context) Create the FluentProducerTemplate by setting the camel contextstatic org.apache.camel.FluentProducerTemplateCreate the FluentProducerTemplate by setting the camel context and default endpointstatic org.apache.camel.FluentProducerTemplateon(org.apache.camel.CamelContext context, org.apache.camel.Endpoint endpoint) Create the FluentProducerTemplate by setting the camel context and default endpointstatic org.apache.camel.FluentProducerTemplateon(org.apache.camel.CamelContext context, org.apache.camel.EndpointProducerResolver resolver) Create the FluentProducerTemplate by setting the camel context and default endpointrequest()<T> Torg.apache.camel.Exchangesend()voidsetDefaultEndpoint(org.apache.camel.Endpoint defaultEndpoint) voidsetDefaultEndpointUri(String endpointUri) voidsetEventNotifierEnabled(boolean eventNotifierEnabled) voidsetMaximumCacheSize(int maximumCacheSize) org.apache.camel.FluentProducerTemplateorg.apache.camel.FluentProducerTemplateto(org.apache.camel.Endpoint endpoint) org.apache.camel.FluentProducerTemplateorg.apache.camel.FluentProducerTemplatewithBodyAs(Object body, Class<?> type) org.apache.camel.FluentProducerTemplatewithDefaultEndpoint(String endpointUri) org.apache.camel.FluentProducerTemplatewithDefaultEndpoint(org.apache.camel.Endpoint endpoint) org.apache.camel.FluentProducerTemplatewithDefaultEndpoint(org.apache.camel.EndpointProducerResolver resolver) org.apache.camel.FluentProducerTemplatewithExchange(Supplier<org.apache.camel.Exchange> exchangeSupplier) org.apache.camel.FluentProducerTemplatewithExchange(org.apache.camel.Exchange exchange) org.apache.camel.FluentProducerTemplatewithHeader(String key, Object value) org.apache.camel.FluentProducerTemplatewithHeaders(Map<String, Object> headers) org.apache.camel.FluentProducerTemplatewithProcessor(Supplier<org.apache.camel.Processor> processorSupplier) org.apache.camel.FluentProducerTemplatewithProcessor(org.apache.camel.Processor processor) org.apache.camel.FluentProducerTemplatewithTemplateCustomizer(Consumer<org.apache.camel.ProducerTemplate> templateCustomizer) Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doLifecycleChange, doResume, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.camel.FluentProducerTemplate
to, toFMethods inherited from interface org.apache.camel.Service
build, close, init, start, stopMethods inherited from interface org.apache.camel.ShutdownableService
shutdownMethods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspendingMethods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
-
Constructor Details
-
DefaultFluentProducerTemplate
public DefaultFluentProducerTemplate(org.apache.camel.CamelContext context)
-
-
Method Details
-
getCamelContext
public org.apache.camel.CamelContext getCamelContext()- Specified by:
getCamelContextin interfaceorg.apache.camel.FluentProducerTemplate
-
getCurrentCacheSize
public int getCurrentCacheSize()- Specified by:
getCurrentCacheSizein interfaceorg.apache.camel.FluentProducerTemplate
-
cleanUp
public void cleanUp()- Specified by:
cleanUpin interfaceorg.apache.camel.FluentProducerTemplate
-
setDefaultEndpointUri
- Specified by:
setDefaultEndpointUriin interfaceorg.apache.camel.FluentProducerTemplate
-
getDefaultEndpoint
public org.apache.camel.Endpoint getDefaultEndpoint()- Specified by:
getDefaultEndpointin interfaceorg.apache.camel.FluentProducerTemplate
-
setDefaultEndpoint
public void setDefaultEndpoint(org.apache.camel.Endpoint defaultEndpoint) - Specified by:
setDefaultEndpointin interfaceorg.apache.camel.FluentProducerTemplate
-
getMaximumCacheSize
public int getMaximumCacheSize()- Specified by:
getMaximumCacheSizein interfaceorg.apache.camel.FluentProducerTemplate
-
setMaximumCacheSize
public void setMaximumCacheSize(int maximumCacheSize) - Specified by:
setMaximumCacheSizein interfaceorg.apache.camel.FluentProducerTemplate
-
isEventNotifierEnabled
public boolean isEventNotifierEnabled()- Specified by:
isEventNotifierEnabledin interfaceorg.apache.camel.FluentProducerTemplate
-
setEventNotifierEnabled
public void setEventNotifierEnabled(boolean eventNotifierEnabled) - Specified by:
setEventNotifierEnabledin interfaceorg.apache.camel.FluentProducerTemplate
-
withHeaders
- Specified by:
withHeadersin interfaceorg.apache.camel.FluentProducerTemplate
-
withHeader
- Specified by:
withHeaderin interfaceorg.apache.camel.FluentProducerTemplate
-
withBody
- Specified by:
withBodyin interfaceorg.apache.camel.FluentProducerTemplate
-
withBodyAs
- Specified by:
withBodyAsin interfaceorg.apache.camel.FluentProducerTemplate
-
withDefaultEndpoint
- Specified by:
withDefaultEndpointin interfaceorg.apache.camel.FluentProducerTemplate
-
withDefaultEndpoint
public org.apache.camel.FluentProducerTemplate withDefaultEndpoint(org.apache.camel.EndpointProducerResolver resolver) - Specified by:
withDefaultEndpointin interfaceorg.apache.camel.FluentProducerTemplate
-
withDefaultEndpoint
public org.apache.camel.FluentProducerTemplate withDefaultEndpoint(org.apache.camel.Endpoint endpoint) - Specified by:
withDefaultEndpointin interfaceorg.apache.camel.FluentProducerTemplate
-
withTemplateCustomizer
public org.apache.camel.FluentProducerTemplate withTemplateCustomizer(Consumer<org.apache.camel.ProducerTemplate> templateCustomizer) - Specified by:
withTemplateCustomizerin interfaceorg.apache.camel.FluentProducerTemplate
-
withExchange
public org.apache.camel.FluentProducerTemplate withExchange(org.apache.camel.Exchange exchange) - Specified by:
withExchangein interfaceorg.apache.camel.FluentProducerTemplate
-
withExchange
public org.apache.camel.FluentProducerTemplate withExchange(Supplier<org.apache.camel.Exchange> exchangeSupplier) - Specified by:
withExchangein interfaceorg.apache.camel.FluentProducerTemplate
-
withProcessor
public org.apache.camel.FluentProducerTemplate withProcessor(org.apache.camel.Processor processor) - Specified by:
withProcessorin interfaceorg.apache.camel.FluentProducerTemplate
-
withProcessor
public org.apache.camel.FluentProducerTemplate withProcessor(Supplier<org.apache.camel.Processor> processorSupplier) - Specified by:
withProcessorin interfaceorg.apache.camel.FluentProducerTemplate
-
to
- Specified by:
toin interfaceorg.apache.camel.FluentProducerTemplate
-
to
public org.apache.camel.FluentProducerTemplate to(org.apache.camel.Endpoint endpoint) - Specified by:
toin interfaceorg.apache.camel.FluentProducerTemplate
-
request
- Specified by:
requestin interfaceorg.apache.camel.FluentProducerTemplate- Throws:
org.apache.camel.CamelExecutionException
-
request
- Specified by:
requestin interfaceorg.apache.camel.FluentProducerTemplate- Throws:
org.apache.camel.CamelExecutionException
-
asyncRequest
- Specified by:
asyncRequestin interfaceorg.apache.camel.FluentProducerTemplate
-
asyncRequest
- Specified by:
asyncRequestin interfaceorg.apache.camel.FluentProducerTemplate
-
send
public org.apache.camel.Exchange send() throws org.apache.camel.CamelExecutionException- Specified by:
sendin interfaceorg.apache.camel.FluentProducerTemplate- Throws:
org.apache.camel.CamelExecutionException
-
asyncSend
- Specified by:
asyncSendin interfaceorg.apache.camel.FluentProducerTemplate
-
on
public static org.apache.camel.FluentProducerTemplate on(org.apache.camel.CamelContext context) Create the FluentProducerTemplate by setting the camel context- Parameters:
context- the camel context- Returns:
- a new created instance of the fluent producer template
-
on
public static org.apache.camel.FluentProducerTemplate on(org.apache.camel.CamelContext context, org.apache.camel.Endpoint endpoint) Create the FluentProducerTemplate by setting the camel context and default endpoint- Parameters:
context- the camel contextendpoint- the default endpoint- Returns:
- a new created instance of the fluent producer template
-
on
public static org.apache.camel.FluentProducerTemplate on(org.apache.camel.CamelContext context, org.apache.camel.EndpointProducerResolver resolver) Create the FluentProducerTemplate by setting the camel context and default endpoint- Parameters:
context- the camel contextresolver- the default endpoint- Returns:
- a new created instance of the fluent producer template
-
on
public static org.apache.camel.FluentProducerTemplate on(org.apache.camel.CamelContext context, String endpoint) Create the FluentProducerTemplate by setting the camel context and default endpoint- Parameters:
context- the camel contextendpoint- the default endpoint- Returns:
- a new created instance of the fluent producer template
-
doInit
- Overrides:
doInitin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doStart
- Overrides:
doStartin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doStop
- Overrides:
doStopin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doShutdown
- Overrides:
doShutdownin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-