public interface CamelContext extends CamelContextLifecycle, RuntimeConfiguration
CamelContextLifecycle
to control the lifecycle:
CamelContextLifecycle.start()
- to start (important: the start method is not blocked, see more details
here)CamelContextLifecycle.stop()
- to shutdown (will stop all routes/components/endpoints etc and clear internal state/cache)CamelContextLifecycle.suspend()
- to pause routing messagesCamelContextLifecycle.resume()
- to resume after a suspendCamelContextLifecycle.stop()
and CamelContextLifecycle.suspend()
will gracefully stop/suspend routes ensuring any messages in
progress will be given time to complete. See more details at ShutdownStrategy
.
If you are doing a hot restart then it's advised to use the suspend/resume methods which ensure a faster restart but
also allows any internal state to be kept as is. The stop/start approach will do a cold restart of Camel,
where all internal state is reset.
End users are advised to use suspend/resume. Using stop is for shutting down Camel and it's not guaranteed that when
it's being started again using the start method that Camel will operate consistently.
For more advanced APIs with CamelContext
see ExtendedCamelContext
, which you can obtain via the adapt
method.Modifier and Type | Method and Description |
---|---|
<T extends CamelContext> |
adapt(Class<T> type)
Adapts this
CamelContext to the specialized type. |
void |
addComponent(String componentName,
Component component)
Adds a component to the context.
|
Endpoint |
addEndpoint(String uri,
Endpoint endpoint)
Adds and starts the endpoint to the
EndpointRegistry using the given URI. |
void |
addLifecycleStrategy(LifecycleStrategy lifecycleStrategy)
Adds the given lifecycle strategy to be used.
|
void |
addPrototypeService(Object object)
Adds a service to this CamelContext (prototype scope).
|
String |
addRouteFromTemplate(String routeId,
String routeTemplateId,
Map<String,Object> parameters)
Adds a new route from a given route template.
|
String |
addRouteFromTemplate(String routeId,
String routeTemplateId,
RouteTemplateContext routeTemplateContext)
Adds a new route from a given route template.
|
void |
addRoutePolicyFactory(RoutePolicyFactory routePolicyFactory)
Adds the given route policy factory
|
void |
addRoutes(RoutesBuilder builder)
Adds a collection of routes to this CamelContext using the given builder to build them.
|
void |
addService(Object object)
Adds a service to this CamelContext, which allows this CamelContext to control the lifecycle, ensuring the
service is stopped when the CamelContext stops.
|
void |
addService(Object object,
boolean stopOnShutdown)
Adds a service to this CamelContext.
|
void |
addService(Object object,
boolean stopOnShutdown,
boolean forceStart)
Adds a service to this CamelContext.
|
void |
addStartupListener(StartupListener listener)
Adds the given listener to be invoked when
CamelContext have just been started. |
ConsumerTemplate |
createConsumerTemplate()
Creates a new
ConsumerTemplate which is started and therefore ready to use right away. |
ConsumerTemplate |
createConsumerTemplate(int maximumCacheSize)
Creates a new
ConsumerTemplate which is started and therefore ready to use right away. |
DataFormat |
createDataFormat(String name)
Creates a new instance of the given data format given its name.
|
FluentProducerTemplate |
createFluentProducerTemplate()
Creates a new
FluentProducerTemplate which is started and therefore ready to use right away. |
FluentProducerTemplate |
createFluentProducerTemplate(int maximumCacheSize)
Creates a new
FluentProducerTemplate which is started and therefore ready to use right away. |
ProducerTemplate |
createProducerTemplate()
Creates a new
ProducerTemplate which is started and therefore ready to use right away. |
ProducerTemplate |
createProducerTemplate(int maximumCacheSize)
Creates a new
ProducerTemplate which is started and therefore ready to use right away. |
void |
deferStartService(Object object,
boolean stopOnShutdown)
Defers starting the service until
CamelContext is (almost started) or started and has initialized all its
prior services and routes. |
void |
disableJMX()
Disables using JMX as
ManagementStrategy . |
ClassLoader |
getApplicationContextClassLoader()
Gets the application CamelContext class loader which may be helpful for running camel in other containers
|
ClassResolver |
getClassResolver()
Returns the class resolver to be used for loading/lookup of classes.
|
Component |
getComponent(String componentName)
Gets a component from the CamelContext by name.
|
Component |
getComponent(String name,
boolean autoCreateComponents)
Gets a component from the CamelContext by name.
|
Component |
getComponent(String name,
boolean autoCreateComponents,
boolean autoStart)
Gets a component from the CamelContext by name.
|
<T extends Component> |
getComponent(String name,
Class<T> componentType)
Gets a component from the CamelContext by name and specifying the expected type of component.
|
List<String> |
getComponentNames()
Gets a readonly list of names of the components currently registered
|
Debugger |
getDebugger()
Gets the current
Debugger |
Endpoint |
getEndpoint(String uri)
Resolves the given name to an
Endpoint of the specified type. |
<T extends Endpoint> |
getEndpoint(String name,
Class<T> endpointType)
Resolves the given name to an
Endpoint of the specified type. |
Endpoint |
getEndpoint(String uri,
Map<String,Object> parameters)
Resolves the given name to an
Endpoint of the specified type. |
Map<String,Endpoint> |
getEndpointMap()
Deprecated.
|
EndpointRegistry<? extends ValueHolder<String>> |
getEndpointRegistry()
Gets the
EndpointRegistry |
Collection<Endpoint> |
getEndpoints()
Returns a new
Collection of all of the endpoints from the EndpointRegistry |
ExecutorServiceManager |
getExecutorServiceManager()
Gets the current
ExecutorServiceManager |
<T> T |
getExtension(Class<T> type)
Gets the extension of the given type.
|
GlobalEndpointConfiguration |
getGlobalEndpointConfiguration()
Gets the global endpoint configuration, where you can configure common endpoint options.
|
String |
getGlobalOption(String key)
Gets the global option value that can be referenced in the camel context
Important: This has nothing to do with property placeholders, and is just a plain set of key/value pairs
which are used to configure global options on CamelContext, such as a maximum debug logging length etc.
|
Map<String,String> |
getGlobalOptions()
Gets global options that can be referenced in the camel context.
|
InflightRepository |
getInflightRepository()
Gets the inflight repository
|
Injector |
getInjector()
Returns the injector used to instantiate objects by type
|
List<String> |
getLanguageNames()
Deprecated.
not in use
|
List<LifecycleStrategy> |
getLifecycleStrategies()
Returns the lifecycle strategies used to handle lifecycle notifications
|
String |
getManagementName()
Gets the name this
CamelContext was registered in JMX. |
ManagementNameStrategy |
getManagementNameStrategy()
Gets the current management name strategy
|
ManagementStrategy |
getManagementStrategy()
Gets the management strategy
|
String |
getMDCLoggingKeysPattern()
Gets the pattern used for determine which custom MDC keys to propagate during message routing when the routing
engine continues routing asynchronously for the given message.
|
MessageHistoryFactory |
getMessageHistoryFactory()
Gets the current
MessageHistoryFactory |
String |
getName()
Gets the name (id) of the this CamelContext.
|
CamelContextNameStrategy |
getNameStrategy()
Gets the current name strategy
|
Processor |
getProcessor(String id)
Gets the processor from any of the routes which with the given id
|
<T extends Processor> |
getProcessor(String id,
Class<T> type)
Gets the processor from any of the routes which with the given id
|
PropertiesComponent |
getPropertiesComponent()
Returns the configured properties component or create one if none has been configured.
|
Registry |
getRegistry()
Returns the registry used to lookup components by name and type such as SimpleRegistry, Spring
ApplicationContext, JNDI, or the OSGi Service Registry.
|
<T> T |
getRegistry(Class<T> type)
Returns the registry used to lookup components by name and as the given type
|
RestConfiguration |
getRestConfiguration()
Gets the default REST configuration
|
RestRegistry |
getRestRegistry()
Gets the
RestRegistry to use |
Route |
getRoute(String id)
Gets the route with the given id
|
RouteController |
getRouteController()
Gets the
RouteController |
List<RoutePolicyFactory> |
getRoutePolicyFactories()
Gets the route policy factories
|
List<Route> |
getRoutes()
Returns the current routes in this CamelContext
|
int |
getRoutesSize()
Returns the total number of routes in this CamelContext
|
RuntimeEndpointRegistry |
getRuntimeEndpointRegistry()
Gets the
RuntimeEndpointRegistry to use, or null if none is in use. |
ShutdownStrategy |
getShutdownStrategy()
Gets the current shutdown strategy.
|
SSLContextParameters |
getSSLContextParameters()
Gets the global SSL context parameters if configured.
|
Date |
getStartDate()
Gets the date and time Camel was started up.
|
StartupSummaryLevel |
getStartupSummaryLevel()
Controls the level of information logged during startup (and shutdown) of
CamelContext . |
StreamCachingStrategy |
getStreamCachingStrategy()
Gets the
StreamCachingStrategy to use. |
Tracer |
getTracer()
Gets the current
Tracer |
TransformerRegistry |
getTransformerRegistry()
Gets the
TransformerRegistry |
TypeConverter |
getTypeConverter()
Returns the type converter used to coerce types from one type to another.
|
TypeConverterRegistry |
getTypeConverterRegistry()
Returns the type converter registry where type converters can be added or looked up
|
String |
getUptime()
Gets the uptime in a human readable format
|
long |
getUptimeMillis()
Gets the uptime in milli seconds
|
UuidGenerator |
getUuidGenerator()
Gets the current
UuidGenerator |
ValidatorRegistry |
getValidatorRegistry()
Gets the
ValidatorRegistry |
String |
getVersion()
Gets the version of the this CamelContext.
|
Component |
hasComponent(String componentName)
Is the given component already registered?
|
Endpoint |
hasEndpoint(String uri)
Is the given endpoint already registered in the
EndpointRegistry |
<T> T |
hasService(Class<T> type)
Has the given service type already been added to this CamelContext?
|
boolean |
hasService(Object object)
Has the given service already been added to this CamelContext?
|
<T> Set<T> |
hasServices(Class<T> type)
Has the given service type already been added to this CamelContext?
|
Boolean |
isDumpRoutes()
If dumping is enabled then Camel will during startup dump all loaded routes (incl rests and route templates)
represented as XML DSL into the log.
|
Boolean |
isLoadTypeConverters()
Whether to load custom type converters by scanning classpath.
|
Boolean |
isTypeConverterStatisticsEnabled()
Whether or not type converter statistics is enabled.
|
Boolean |
isUseBreadcrumb()
Whether or not breadcrumb is enabled.
|
Boolean |
isUseDataType()
Whether to enable using data type on Camel messages.
|
Boolean |
isUseMDCLogging()
Whether or not MDC logging is being enabled.
|
boolean |
isVetoStarted()
If CamelContext during the start procedure was vetoed, and therefore causing Camel to not start.
|
Component |
removeComponent(String componentName)
Removes a previously added component.
|
void |
removeEndpoint(Endpoint endpoint)
Removes the endpoint from the
EndpointRegistry . |
Collection<Endpoint> |
removeEndpoints(String pattern)
Removes all endpoints with the given URI from the
EndpointRegistry . |
boolean |
removeRoute(String routeId)
Removes the given route (the route must be stopped before it can be removed).
|
boolean |
removeService(Object object)
Removes a service from this CamelContext.
|
DataFormat |
resolveDataFormat(String name)
Resolve an existing data format, or creates a new by the given its name
|
Language |
resolveLanguage(String language)
Resolves a language for creating expressions
|
String |
resolvePropertyPlaceholders(String text)
Parses the given text and resolve any property placeholders - using {{key}}.
|
Transformer |
resolveTransformer(DataType from,
DataType to)
Resolve a transformer given from/to data type.
|
Transformer |
resolveTransformer(String model)
Resolve a transformer given a scheme
|
Validator |
resolveValidator(DataType type)
Resolve a validator given from/to data type.
|
void |
setApplicationContextClassLoader(ClassLoader classLoader)
Sets the application CamelContext class loader
|
void |
setClassResolver(ClassResolver resolver)
Sets the class resolver to be use
|
void |
setDebugger(Debugger debugger)
Sets a custom
Debugger |
void |
setDumpRoutes(Boolean dumpRoutes)
If dumping is enabled then Camel will during startup dump all loaded routes (incl rests and route templates)
represented as XML DSL into the log.
|
void |
setExecutorServiceManager(ExecutorServiceManager executorServiceManager)
Sets a custom
ExecutorServiceManager |
<T> void |
setExtension(Class<T> type,
T module)
Allows to install custom extensions to the Camel context.
|
void |
setGlobalOptions(Map<String,String> globalOptions)
Sets global options that can be referenced in the camel context
Important: This has nothing to do with property placeholders, and is just a plain set of key/value pairs
which are used to configure global options on CamelContext, such as a maximum debug logging length etc.
|
void |
setInflightRepository(InflightRepository repository)
Sets a custom inflight repository to use
|
void |
setInjector(Injector injector)
Sets the injector to use
|
void |
setLoadTypeConverters(Boolean loadTypeConverters)
Whether to load custom type converters by scanning classpath.
|
void |
setManagementName(String name)
Sets the name this
CamelContext will be registered in JMX. |
void |
setManagementNameStrategy(ManagementNameStrategy nameStrategy)
Sets a custom management name strategy
|
void |
setManagementStrategy(ManagementStrategy strategy)
Sets the management strategy to use
|
void |
setMDCLoggingKeysPattern(String pattern)
Sets the pattern used for determine which custom MDC keys to propagate during message routing when the routing
engine continues routing asynchronously for the given message.
|
void |
setMessageHistoryFactory(MessageHistoryFactory messageHistoryFactory)
Sets a custom
MessageHistoryFactory |
void |
setNameStrategy(CamelContextNameStrategy nameStrategy)
Sets a custom name strategy
|
void |
setPropertiesComponent(PropertiesComponent propertiesComponent)
Sets a custom properties component to be used.
|
void |
setRestConfiguration(RestConfiguration restConfiguration)
Sets a custom
RestConfiguration |
void |
setRestRegistry(RestRegistry restRegistry)
Sets a custom
RestRegistry to use. |
void |
setRouteController(RouteController routeController)
Sets a custom
RouteController to use |
void |
setRuntimeEndpointRegistry(RuntimeEndpointRegistry runtimeEndpointRegistry)
Sets a custom
RuntimeEndpointRegistry to use. |
void |
setShutdownStrategy(ShutdownStrategy shutdownStrategy)
Sets a custom shutdown strategy
|
void |
setSSLContextParameters(SSLContextParameters sslContextParameters)
Sets the global SSL context parameters.
|
void |
setStartupSummaryLevel(StartupSummaryLevel startupSummaryLevel)
Controls the level of information logged during startup (and shutdown) of
CamelContext . |
void |
setStreamCachingStrategy(StreamCachingStrategy streamCachingStrategy)
Sets a custom
StreamCachingStrategy to use. |
void |
setTracer(Tracer tracer)
Sets a custom
Tracer |
void |
setTypeConverterRegistry(TypeConverterRegistry typeConverterRegistry)
Configures the type converter registry to use, where type converters can be added or looked up.
|
void |
setTypeConverterStatisticsEnabled(Boolean typeConverterStatisticsEnabled)
Sets whether or not type converter statistics is enabled.
|
void |
setUseBreadcrumb(Boolean useBreadcrumb)
Set whether breadcrumb is enabled.
|
void |
setUseDataType(Boolean useDataType)
Whether to enable using data type on Camel messages.
|
void |
setUseMDCLogging(Boolean useMDCLogging)
Set whether MDC is enabled.
|
void |
setUuidGenerator(UuidGenerator uuidGenerator)
Sets a custom
UuidGenerator (should only be set once) |
build, close, getStatus, init, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspended, isSuspending, resume, shutdown, start, stop, suspend
getDelayer, getShutdownRoute, getShutdownRunningTask, getTracingPattern, isAllowUseOriginalMessage, isAutoStartup, isAutowiredEnabled, isBacklogTracing, isCaseInsensitiveHeaders, isDebugging, isLogExhaustedMessageBody, isLogMask, isMessageHistory, isStreamCaching, isTracing, setAllowUseOriginalMessage, setAutoStartup, setAutowiredEnabled, setBacklogTracing, setCaseInsensitiveHeaders, setDebugging, setDelayer, setLogExhaustedMessageBody, setLogMask, setMessageHistory, setShutdownRoute, setShutdownRunningTask, setStreamCaching, setTracing, setTracingPattern
<T extends CamelContext> T adapt(Class<T> type)
CamelContext
to the specialized type.
For example to adapt to ExtendedCamelContext, ModelCamelContext, or
SpringCamelContext, or CdiCamelContext, etc.type
- the type to adapt toCamelContext
adapted to the given type<T> T getExtension(Class<T> type)
type
- the type of the extension<T> void setExtension(Class<T> type, T module)
type
- the type of the extensionmodule
- the instance of the extensionboolean isVetoStarted()
String getName()
CamelContextNameStrategy getNameStrategy()
void setNameStrategy(CamelContextNameStrategy nameStrategy)
nameStrategy
- name strategyManagementNameStrategy getManagementNameStrategy()
void setManagementNameStrategy(ManagementNameStrategy nameStrategy)
nameStrategy
- name strategyString getManagementName()
CamelContext
was registered in JMX.
The reason that a CamelContext
can have a different name in JMX is the fact to remedy for name clash in
JMX when having multiple CamelContext
s in the same JVM. Camel will automatic reassign and use a free name
to avoid failing to start.void setManagementName(String name)
CamelContext
will be registered in JMX.String getVersion()
String getUptime()
long getUptimeMillis()
Date getStartDate()
void addService(Object object) throws Exception
CamelContext
injected if its CamelContextAware
. The service will also
be enlisted in JMX for management (if JMX is enabled). The service will be started, if its not already started.object
- the serviceException
- can be thrown when starting the servicevoid addService(Object object, boolean stopOnShutdown) throws Exception
CamelContext
injected if its CamelContextAware
. The service will also
be enlisted in JMX for management (if JMX is enabled). The service will be started, if its not already started.
If the option closeOnShutdown is true then this CamelContext will control the lifecycle,
ensuring the service is stopped when the CamelContext stops. If the option closeOnShutdown is
false then this CamelContext will not stop the service when the CamelContext stops.object
- the servicestopOnShutdown
- whether to stop the service when this CamelContext shutdown.Exception
- can be thrown when starting the servicevoid addService(Object object, boolean stopOnShutdown, boolean forceStart) throws Exception
CamelContext
injected if its CamelContextAware
. The service will also
be enlisted in JMX for management (if JMX is enabled). The service will be started, if its not already started.
If the option closeOnShutdown is true then this CamelContext will control the lifecycle,
ensuring the service is stopped when the CamelContext stops. If the option closeOnShutdown is
false then this CamelContext will not stop the service when the CamelContext stops.object
- the servicestopOnShutdown
- whether to stop the service when this CamelContext shutdown.forceStart
- whether to force starting the service right now, as otherwise the service may be deferred
being started to later using deferStartService(Object, boolean)
Exception
- can be thrown when starting the servicevoid addPrototypeService(Object object) throws Exception
CamelContext
injected if its CamelContextAware
. The service will be
started, if its not already started.object
- the serviceException
- can be thrown when starting the serviceboolean removeService(Object object) throws Exception
addService(Object)
method. This method will
not change the service lifecycle.object
- the serviceException
- can be thrown if error removing the serviceboolean hasService(Object object)
object
- the service<T> T hasService(Class<T> type)
type
- the class type<T> Set<T> hasServices(Class<T> type)
type
- the class typevoid deferStartService(Object object, boolean stopOnShutdown) throws Exception
CamelContext
is (almost started) or started and has initialized all its
prior services and routes.
If CamelContext
is already started then the service is started immediately.object
- the servicestopOnShutdown
- whether to stop the service when this CamelContext shutdown. Setting this to true
will keep a reference to the service in this CamelContext
until the CamelContext
is stopped. So do not use it for short lived services.Exception
- can be thrown when starting the service, which is only attempted if CamelContext
has already been started when calling this method.void addStartupListener(StartupListener listener) throws Exception
CamelContext
have just been started.
This allows listeners to do any custom work after the routes and other services have been started and are
running.
Important: The listener will always be invoked, also if the CamelContext
has already been started,
see the StartupListener.onCamelContextStarted(CamelContext, boolean)
method.listener
- the listenerException
- can be thrown if CamelContext
is already started and the listener is invoked and cause
an exception to be thrownvoid addComponent(String componentName, Component component)
componentName
- the name the component is registered ascomponent
- the componentComponent hasComponent(String componentName)
componentName
- the name of the componentComponent getComponent(String componentName)
getComponent(String, boolean, boolean)
.componentName
- the name of the componentComponent getComponent(String name, boolean autoCreateComponents)
getComponent(String, boolean, boolean)
.name
- the name of the componentautoCreateComponents
- whether or not the component should be lazily created if it does not already existComponent getComponent(String name, boolean autoCreateComponents, boolean autoStart)
name
- the name of the componentautoCreateComponents
- whether or not the component should be lazily created if it does not already existautoStart
- whether to auto start the component if CamelContext
is already started.<T extends Component> T getComponent(String name, Class<T> componentType)
name
- the name to lookupcomponentType
- the expected typeList<String> getComponentNames()
Component removeComponent(String componentName)
componentName
- the component name to removeEndpointRegistry<? extends ValueHolder<String>> getEndpointRegistry()
EndpointRegistry
Endpoint getEndpoint(String uri)
Endpoint
of the specified type. If the name has a singleton endpoint
registered, then the singleton is returned. Otherwise, a new Endpoint
is created and registered in the
EndpointRegistry
.uri
- the URI of the endpointEndpoint getEndpoint(String uri, Map<String,Object> parameters)
Endpoint
of the specified type. If the name has a singleton endpoint
registered, then the singleton is returned. Otherwise, a new Endpoint
is created and registered in the
EndpointRegistry
.uri
- the URI of the endpointparameters
- the parameters to customize the endpoint<T extends Endpoint> T getEndpoint(String name, Class<T> endpointType)
Endpoint
of the specified type. If the name has a singleton endpoint
registered, then the singleton is returned. Otherwise, a new Endpoint
is created and registered in the
EndpointRegistry
.name
- the name of the endpointendpointType
- the expected typeCollection<Endpoint> getEndpoints()
Collection
of all of the endpoints from the EndpointRegistry
@Deprecated Map<String,Endpoint> getEndpointMap()
getEndpointRegistry()
Map
containing all of the endpoints from the EndpointRegistry
Endpoint hasEndpoint(String uri)
EndpointRegistry
uri
- the URI of the endpointEndpoint addEndpoint(String uri, Endpoint endpoint) throws Exception
EndpointRegistry
using the given URI.uri
- the URI to be used to resolve this endpointendpoint
- the endpoint to be started and added to the registryException
- if the new endpoint could not be started or the old endpoint could not be stoppedvoid removeEndpoint(Endpoint endpoint) throws Exception
EndpointRegistry
.
The endpoint being removed will be stopped first.endpoint
- the endpointException
- if the endpoint could not be stoppedCollection<Endpoint> removeEndpoints(String pattern) throws Exception
EndpointRegistry
.
The endpoints being removed will be stopped first.pattern
- an uri or pattern to matchException
- if at least one endpoint could not be stoppedfor pattern
GlobalEndpointConfiguration getGlobalEndpointConfiguration()
void setRouteController(RouteController routeController)
RouteController
to userouteController
- the route controllerRouteController getRouteController()
RouteController
List<Route> getRoutes()
int getRoutesSize()
Route getRoute(String id)
id
- id of the routeProcessor getProcessor(String id)
id
- id of the processor<T extends Processor> T getProcessor(String id, Class<T> type)
id
- id of the processortype
- the processor typeClassCastException
- is thrown if the type is not correct typevoid addRoutes(RoutesBuilder builder) throws Exception
CamelContext
is already started. You
may want to check the state of CamelContext
before adding the routes, using the
CamelContextLifecycle.getStatus()
method.
Important: Each route in the same CamelContext
must have an unique route
id. If you use the API from CamelContext
or
org.apache.camel.model.ModelCamelContext
to add routes, then any new routes which has a route id that
matches an old route, then the old route is replaced by the new route.builder
- the builder which will create the routes and add them to this CamelContextException
- if the routes could not be created for whatever reasonboolean removeRoute(String routeId) throws Exception
Endpoint
s which are in the static cache of
EndpointRegistry
and are only used by the route (not used by other routes)
will also be removed. But Endpoint
s which may have been created as part of routing messages by the route,
and those endpoints are enlisted in the dynamic cache of EndpointRegistry
are
not removed. To remove those dynamic kind of endpoints, use the removeEndpoints(String)
method.
If not removing those endpoints, they will be kept in the dynamic cache of
EndpointRegistry
, but my eventually be removed (evicted) when they have not been in
use for a longer period of time; and the dynamic cache upper limit is hit, and it evicts the least used
endpoints.
End users can use this method to remove unwanted routes or temporary routes which no longer is in demand.routeId
- the route idException
- is thrown if the route could not be shutdown for whatever reasonString addRouteFromTemplate(String routeId, String routeTemplateId, Map<String,Object> parameters) throws Exception
org.apache.camel.builder.TemplatedRouteBuilder
which is a fluent
builder with more functionality than this API.routeId
- the id of the new route to add (optional)routeTemplateId
- the id of the route template (mandatory)parameters
- parameters to use for the route template when creating the new routeException
- is thrown if error creating and adding the new routeString addRouteFromTemplate(String routeId, String routeTemplateId, RouteTemplateContext routeTemplateContext) throws Exception
org.apache.camel.builder.TemplatedRouteBuilder
which is a fluent
builder with more functionality than this API.routeId
- the id of the new route to add (optional)routeTemplateId
- the id of the route template (mandatory)routeTemplateContext
- the route template context (mandatory)Exception
- is thrown if error creating and adding the new routevoid addRoutePolicyFactory(RoutePolicyFactory routePolicyFactory)
routePolicyFactory
- the factoryList<RoutePolicyFactory> getRoutePolicyFactories()
void setRestConfiguration(RestConfiguration restConfiguration)
RestConfiguration
restConfiguration
- the REST configurationRestConfiguration getRestConfiguration()
RestRegistry getRestRegistry()
RestRegistry
to usevoid setRestRegistry(RestRegistry restRegistry)
RestRegistry
to use.TypeConverter getTypeConverter()
CamelContext
should be at least initialized before you can get the type converter.TypeConverterRegistry getTypeConverterRegistry()
void setTypeConverterRegistry(TypeConverterRegistry typeConverterRegistry)
typeConverterRegistry
- the registry to useRegistry getRegistry()
<T> T getRegistry(Class<T> type)
type
- the registry type such as org.apache.camel.impl.JndiRegistryInjector getInjector()
void setInjector(Injector injector)
List<LifecycleStrategy> getLifecycleStrategies()
void addLifecycleStrategy(LifecycleStrategy lifecycleStrategy)
lifecycleStrategy
- the strategyLanguage resolveLanguage(String language) throws NoSuchLanguageException
language
- name of the languageNoSuchLanguageException
- is thrown if language could not be resolvedString resolvePropertyPlaceholders(String text)
text
- the text such as an endpoint uri or the likesIllegalArgumentException
- is thrown if property placeholders was used and there was an error resolving
themPropertiesComponent getPropertiesComponent()
void setPropertiesComponent(PropertiesComponent propertiesComponent)
@Deprecated List<String> getLanguageNames()
ProducerTemplate createProducerTemplate()
ProducerTemplate
which is started and therefore ready to use right away.
See this FAQ before use:
Why does Camel
use too many threads with ProducerTemplate?
Important: Make sure to call Service.stop()
when you are done using the
template, to clean up any resources.
Will use cache size defined in Camel property with key Exchange.MAXIMUM_CACHE_POOL_SIZE
. If no key was
defined then it will fallback to a default size of 1000. You can also use the
ProducerTemplate.setMaximumCacheSize(int)
method to use a custom value before starting
the template.RuntimeCamelException
- is thrown if error starting the templateProducerTemplate createProducerTemplate(int maximumCacheSize)
ProducerTemplate
which is started and therefore ready to use right away.
See this FAQ before use:
Why does Camel
use too many threads with ProducerTemplate?
Important: Make sure to call Service.stop()
when you are done using the template, to
clean up any resources.maximumCacheSize
- the maximum cache sizeRuntimeCamelException
- is thrown if error starting the templateFluentProducerTemplate createFluentProducerTemplate()
FluentProducerTemplate
which is started and therefore ready to use right away.
See this FAQ before use:
Why does Camel
use too many threads with ProducerTemplate?
Important: Make sure to call Service.stop()
when you are done
using the template, to clean up any resources.
Will use cache size defined in Camel property with key Exchange.MAXIMUM_CACHE_POOL_SIZE
. If no key was
defined then it will fallback to a default size of 1000. You can also use the
FluentProducerTemplate.setMaximumCacheSize(int)
method to use a custom value before
starting the template.RuntimeCamelException
- is thrown if error starting the templateFluentProducerTemplate createFluentProducerTemplate(int maximumCacheSize)
FluentProducerTemplate
which is started and therefore ready to use right away.
See this FAQ before use:
Why does Camel
use too many threads with ProducerTemplate?
Important: Make sure to call Service.stop()
when you are done using the template,
to clean up any resources.maximumCacheSize
- the maximum cache sizeRuntimeCamelException
- is thrown if error starting the templateConsumerTemplate createConsumerTemplate()
ConsumerTemplate
which is started and therefore ready to use right away.
See this FAQ before use:
Why does Camel
use too many threads with ProducerTemplate? as it also applies for ConsumerTemplate.
Important: Make sure to call Service.stop()
when you are done using the template, to
clean up any resources.
Will use cache size defined in Camel property with key Exchange.MAXIMUM_CACHE_POOL_SIZE
. If no key was
defined then it will fallback to a default size of 1000. You can also use the
ConsumerTemplate.setMaximumCacheSize(int)
method to use a custom value before starting
the template.RuntimeCamelException
- is thrown if error starting the templateConsumerTemplate createConsumerTemplate(int maximumCacheSize)
ConsumerTemplate
which is started and therefore ready to use right away.
See this FAQ before use:
Why does Camel
use too many threads with ProducerTemplate? as it also applies for ConsumerTemplate.
Important: Make sure to call Service.stop()
when you are done using the template, to
clean up any resources.maximumCacheSize
- the maximum cache sizeRuntimeCamelException
- is thrown if error starting the templateDataFormat resolveDataFormat(String name)
name
- the data format name or a reference to it in the Registry
DataFormat createDataFormat(String name)
name
- the data format name or a reference to a data format factory in the Registry
Transformer resolveTransformer(String model)
model
- data model name.Transformer resolveTransformer(DataType from, DataType to)
from
- from data typeto
- to data typeTransformerRegistry getTransformerRegistry()
TransformerRegistry
Validator resolveValidator(DataType type)
type
- the data typeValidatorRegistry getValidatorRegistry()
ValidatorRegistry
void setGlobalOptions(Map<String,String> globalOptions)
resolvePropertyPlaceholders(String)
method and see more details at the
property placeholder documentation.globalOptions
- global options that can be referenced in the camel contextMap<String,String> getGlobalOptions()
resolvePropertyPlaceholders(String)
method and see more details at the
property placeholder documentation.String getGlobalOption(String key)
resolvePropertyPlaceholders(String)
method and see more details at the
property placeholder documentation.ClassResolver getClassResolver()
void setClassResolver(ClassResolver resolver)
resolver
- the resolverManagementStrategy getManagementStrategy()
void setManagementStrategy(ManagementStrategy strategy)
strategy
- the management strategyvoid disableJMX() throws IllegalStateException
ManagementStrategy
.
Important: This method must be called before the CamelContext
is started.IllegalStateException
- is thrown if the CamelContext
is not in stopped state.InflightRepository getInflightRepository()
void setInflightRepository(InflightRepository repository)
repository
- the repositoryClassLoader getApplicationContextClassLoader()
void setApplicationContextClassLoader(ClassLoader classLoader)
classLoader
- the class loaderShutdownStrategy getShutdownStrategy()
RouteController
via CamelContext
.void setShutdownStrategy(ShutdownStrategy shutdownStrategy)
shutdownStrategy
- the custom strategyExecutorServiceManager getExecutorServiceManager()
ExecutorServiceManager
void setExecutorServiceManager(ExecutorServiceManager executorServiceManager)
ExecutorServiceManager
executorServiceManager
- the custom managerMessageHistoryFactory getMessageHistoryFactory()
MessageHistoryFactory
void setMessageHistoryFactory(MessageHistoryFactory messageHistoryFactory)
MessageHistoryFactory
messageHistoryFactory
- the custom factoryvoid setDebugger(Debugger debugger)
Debugger
debugger
- the debuggerUuidGenerator getUuidGenerator()
UuidGenerator
void setUuidGenerator(UuidGenerator uuidGenerator)
UuidGenerator
(should only be set once)uuidGenerator
- the UUID GeneratorBoolean isLoadTypeConverters()
void setLoadTypeConverters(Boolean loadTypeConverters)
loadTypeConverters
- whether to load custom type converters using classpath scanning.Boolean isTypeConverterStatisticsEnabled()
void setTypeConverterStatisticsEnabled(Boolean typeConverterStatisticsEnabled)
org.apache.camel.spi.TypeConverterRegistry#getStatistics()#setTypeConverterStatisticsEnabled(Boolean)
method, or from JMX on the org.apache.camel.api.management.mbean.ManagedTypeConverterRegistryMBean
mbean.typeConverterStatisticsEnabled
- true to enable, false to disableBoolean isUseMDCLogging()
void setUseMDCLogging(Boolean useMDCLogging)
useMDCLogging
- true to enable MDC logging, false to disableString getMDCLoggingKeysPattern()
void setMDCLoggingKeysPattern(String pattern)
pattern
- the patternBoolean isDumpRoutes()
void setDumpRoutes(Boolean dumpRoutes)
dumpRoutes
- true to enable dumping routes.Boolean isUseDataType()
void setUseDataType(Boolean useDataType)
useDataType
- true to enable data type on Camel messages.Boolean isUseBreadcrumb()
void setUseBreadcrumb(Boolean useBreadcrumb)
useBreadcrumb
- true to enable breadcrumb, false to disableStreamCachingStrategy getStreamCachingStrategy()
StreamCachingStrategy
to use.void setStreamCachingStrategy(StreamCachingStrategy streamCachingStrategy)
StreamCachingStrategy
to use.RuntimeEndpointRegistry getRuntimeEndpointRegistry()
RuntimeEndpointRegistry
to use, or null if none is in use.void setRuntimeEndpointRegistry(RuntimeEndpointRegistry runtimeEndpointRegistry)
RuntimeEndpointRegistry
to use.void setSSLContextParameters(SSLContextParameters sslContextParameters)
SSLContextParameters getSSLContextParameters()
void setStartupSummaryLevel(StartupSummaryLevel startupSummaryLevel)
CamelContext
.StartupSummaryLevel getStartupSummaryLevel()
CamelContext
.Apache Camel