Package org.apache.camel
Interface CamelContext
-
- All Superinterfaces:
AutoCloseable
,CamelContextLifecycle
,RuntimeConfiguration
- All Known Subinterfaces:
CatalogCamelContext
,ExtendedCamelContext
public interface CamelContext extends CamelContextLifecycle, RuntimeConfiguration
Interface used to represent the CamelContext used to configure routes and the policies to use during message exchanges between endpoints. The CamelContext offers the following methodsCamelContextLifecycle
to control the lifecycle:CamelContextLifecycle.start()
- to startCamelContextLifecycle.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 suspend
CamelContextLifecycle.stop()
andCamelContextLifecycle.suspend()
will gracefully stop/suspend routes ensuring any messages in progress will be given time to complete. See more details atShutdownStrategy
. 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 withCamelContext
seeExtendedCamelContext
, which you can obtain via the adapt method.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description <T extends CamelContext>
Tadapt(Class<T> type)
Adapts thisCamelContext
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 theEndpointRegistry
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, String prefixId, Map<String,Object> parameters)
Adds a new route from a given route template.String
addRouteFromTemplate(String routeId, String routeTemplateId, String prefixId, RouteTemplateContext routeTemplateContext)
Adds a new route from a given route template.String
addRouteFromTemplate(String routeId, String routeTemplateId, Map<String,Object> parameters)
Deprecated.String
addRouteFromTemplate(String routeId, String routeTemplateId, RouteTemplateContext routeTemplateContext)
void
addRoutePolicyFactory(RoutePolicyFactory routePolicyFactory)
Adds the given route policy factoryvoid
addRoutes(RoutesBuilder builder)
Adds a collection of routes to this CamelContext using the given builder to build them.void
addRoutesConfigurations(RouteConfigurationsBuilder builder)
Adds the routes configurations (global configuration for all routes) from the routes builder.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 whenCamelContext
have just been started.void
addTemplatedRoutes(RoutesBuilder builder)
Adds the templated routes from the routes builder.ConsumerTemplate
createConsumerTemplate()
Creates a newConsumerTemplate
which is started and therefore ready to use right away.ConsumerTemplate
createConsumerTemplate(int maximumCacheSize)
Creates a newConsumerTemplate
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 newFluentProducerTemplate
which is started and therefore ready to use right away.FluentProducerTemplate
createFluentProducerTemplate(int maximumCacheSize)
Creates a newFluentProducerTemplate
which is started and therefore ready to use right away.ProducerTemplate
createProducerTemplate()
Creates a newProducerTemplate
which is started and therefore ready to use right away.ProducerTemplate
createProducerTemplate(int maximumCacheSize)
Creates a newProducerTemplate
which is started and therefore ready to use right away.void
deferStartService(Object object, boolean stopOnShutdown)
Defers starting the service untilCamelContext
is (almost started) or started and has initialized all its prior services and routes.void
disableJMX()
Disables using JMX asManagementStrategy
.ClassLoader
getApplicationContextClassLoader()
Gets the application CamelContext class loader which may be helpful for running camel in other containersClassResolver
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>
TgetComponent(String name, Class<T> componentType)
Gets a component from the CamelContext by name and specifying the expected type of component.Set<String>
getComponentNames()
Gets a readonly list of names of the components currently registeredSet<String>
getDataFormatNames()
Gets a readonly list of names of the data formats currently registeredDebugger
getDebugger()
Gets the currentDebugger
String
getDescription()
Gets the description of this CamelContext.Endpoint
getEndpoint(String uri)
Resolves the given name to anEndpoint
of the specified type.<T extends Endpoint>
TgetEndpoint(String name, Class<T> endpointType)
Resolves the given name to anEndpoint
of the specified type.Endpoint
getEndpoint(String uri, Map<String,Object> parameters)
Resolves the given name to anEndpoint
of the specified type.Map<String,Endpoint>
getEndpointMap()
Deprecated.EndpointRegistry<? extends ValueHolder<String>>
getEndpointRegistry()
Gets theEndpointRegistry
Collection<Endpoint>
getEndpoints()
Returns a read-onlyCollection
of all of the endpoints from theEndpointRegistry
ExecutorServiceManager
getExecutorServiceManager()
Gets the currentExecutorServiceManager
<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 contextMap<String,String>
getGlobalOptions()
Gets global options that can be referenced in the camel context.InflightRepository
getInflightRepository()
Gets the inflight repositoryInjector
getInjector()
Returns the injector used to instantiate objects by typeSet<String>
getLanguageNames()
Gets a readonly list with the names of the languages currently registered.List<LifecycleStrategy>
getLifecycleStrategies()
Returns the lifecycle strategies used to handle lifecycle notificationsString
getManagementName()
Gets the name thisCamelContext
was registered in JMX.ManagementNameStrategy
getManagementNameStrategy()
Gets the current management name strategyManagementStrategy
getManagementStrategy()
Gets the management strategyString
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 currentMessageHistoryFactory
String
getName()
Gets the name (id) of this CamelContext.CamelContextNameStrategy
getNameStrategy()
Gets the current name strategyProcessor
getProcessor(String id)
Gets the processor from any of the routes which with the given id<T extends Processor>
TgetProcessor(String id, Class<T> type)
Gets the processor from any of the routes which with the given idPropertiesComponent
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 typeRestConfiguration
getRestConfiguration()
Gets the default REST configurationRestRegistry
getRestRegistry()
Gets theRestRegistry
to useRoute
getRoute(String id)
Gets the route with the given idRouteController
getRouteController()
Gets theRouteController
List<RoutePolicyFactory>
getRoutePolicyFactories()
Gets the route policy factoriesList<Route>
getRoutes()
Returns the current routes in this CamelContextint
getRoutesSize()
Returns the total number of routes in this CamelContextRuntimeEndpointRegistry
getRuntimeEndpointRegistry()
Gets theRuntimeEndpointRegistry
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) ofCamelContext
.StreamCachingStrategy
getStreamCachingStrategy()
Gets theStreamCachingStrategy
to use.Tracer
getTracer()
Gets the currentTracer
String
getTracingLoggingFormat()
To use a custom tracing logging format.TransformerRegistry
getTransformerRegistry()
Gets theTransformerRegistry
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 upString
getUptime()
Gets the uptime in a human readable formatlong
getUptimeMillis()
Gets the uptime in milli secondsUuidGenerator
getUuidGenerator()
Gets the currentUuidGenerator
ValidatorRegistry
getValidatorRegistry()
Gets theValidatorRegistry
VaultConfiguration
getVaultConfiguration()
Gets the vault configurationString
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 theEndpointRegistry
<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
isBacklogTracingStandby()
Whether to set backlog tracing on standby.Boolean
isDevConsole()
Whether to enable developer console (requires camel-console on classpath).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
isLoadHealthChecks()
Whether to load custom health checks by scanning classpath.Boolean
isLoadTypeConverters()
Whether to load custom type converters by scanning classpath.Boolean
isModeline()
Whether camel-k style modeline is also enabled when not using camel-k.Boolean
isSourceLocationEnabled()
Whether to capture precise source location:line-number for all EIPs in Camel routes.boolean
isTracingStandby()
Whether to set tracing on standby.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 theEndpointRegistry
.Collection<Endpoint>
removeEndpoints(String pattern)
Removes all endpoints with the given URI from theEndpointRegistry
.boolean
removeRoute(String routeId)
Removes the given route (the route must be stopped before it can be removed).void
removeRouteTemplates(String pattern)
Removes the route templates matching the patternboolean
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 nameLanguage
resolveLanguage(String language)
Resolves a language for creating expressionsString
resolvePropertyPlaceholders(String text)
Parses the given text and resolve any property placeholders - using {{key}}.Transformer
resolveTransformer(String model)
Resolve a transformer given a schemeTransformer
resolveTransformer(DataType from, DataType to)
Resolve a transformer given from/to data type.Validator
resolveValidator(DataType type)
Resolve a validator given from/to data type.void
setApplicationContextClassLoader(ClassLoader classLoader)
Sets the application CamelContext class loadervoid
setBacklogTracingStandby(boolean backlogTracingStandby)
Whether to set backlog tracing on standby.void
setClassResolver(ClassResolver resolver)
Sets the class resolver to be usevoid
setDebugger(Debugger debugger)
Sets a customDebugger
void
setDevConsole(Boolean loadDevConsoles)
Whether to enable developer console (requires camel-console on classpath) The developer console is only for assisting during development.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 customExecutorServiceManager
<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 contextvoid
setInflightRepository(InflightRepository repository)
Sets a custom inflight repository to usevoid
setInjector(Injector injector)
Sets the injector to usevoid
setLoadHealthChecks(Boolean loadHealthChecks)
Whether to load custom health checks by scanning classpath.void
setLoadTypeConverters(Boolean loadTypeConverters)
Whether to load custom type converters by scanning classpath.void
setManagementName(String name)
Sets the name thisCamelContext
will be registered in JMX.void
setManagementNameStrategy(ManagementNameStrategy nameStrategy)
Sets a custom management name strategyvoid
setManagementStrategy(ManagementStrategy strategy)
Sets the management strategy to usevoid
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 customMessageHistoryFactory
void
setModeline(Boolean modeline)
Whether camel-k style modeline is also enabled when not using camel-k.void
setNameStrategy(CamelContextNameStrategy nameStrategy)
Sets a custom name strategyvoid
setPropertiesComponent(PropertiesComponent propertiesComponent)
Sets a custom properties component to be used.void
setRestConfiguration(RestConfiguration restConfiguration)
Sets a customRestConfiguration
void
setRestRegistry(RestRegistry restRegistry)
Sets a customRestRegistry
to use.void
setRouteController(RouteController routeController)
Sets a customRouteController
to usevoid
setRuntimeEndpointRegistry(RuntimeEndpointRegistry runtimeEndpointRegistry)
Sets a customRuntimeEndpointRegistry
to use.void
setShutdownStrategy(ShutdownStrategy shutdownStrategy)
Sets a custom shutdown strategyvoid
setSourceLocationEnabled(Boolean sourceLocationEnabled)
Whether to capture precise source location:line-number for all EIPs in Camel routes.void
setSSLContextParameters(SSLContextParameters sslContextParameters)
Sets the global SSL context parameters.void
setStartupSummaryLevel(StartupSummaryLevel startupSummaryLevel)
Controls the level of information logged during startup (and shutdown) ofCamelContext
.void
setStreamCachingStrategy(StreamCachingStrategy streamCachingStrategy)
Sets a customStreamCachingStrategy
to use.void
setTracer(Tracer tracer)
Sets a customTracer
void
setTracingLoggingFormat(String format)
To use a custom tracing logging format.void
setTracingStandby(boolean tracingStandby)
Whether to set tracing on standby.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 customUuidGenerator
(should only be set once)void
setVaultConfiguration(VaultConfiguration vaultConfiguration)
Sets a customVaultConfiguration
-
Methods inherited from interface org.apache.camel.CamelContextLifecycle
build, close, getStatus, init, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspended, isSuspending, resume, shutdown, start, stop, suspend
-
Methods inherited from interface org.apache.camel.RuntimeConfiguration
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
-
-
-
-
Method Detail
-
adapt
<T extends CamelContext> T adapt(Class<T> type)
Adapts thisCamelContext
to the specialized type. For example to adapt to ExtendedCamelContext, ModelCamelContext, or SpringCamelContext, or CdiCamelContext, etc.- Parameters:
type
- the type to adapt to- Returns:
- this
CamelContext
adapted to the given type
-
getExtension
<T> T getExtension(Class<T> type)
Gets the extension of the given type.- Parameters:
type
- the type of the extension- Returns:
- the extension, or null if no extension has been installed.
-
setExtension
<T> void setExtension(Class<T> type, T module)
Allows to install custom extensions to the Camel context.- Parameters:
type
- the type of the extensionmodule
- the instance of the extension
-
isVetoStarted
boolean isVetoStarted()
If CamelContext during the start procedure was vetoed, and therefore causing Camel to not start.
-
getName
String getName()
Gets the name (id) of this CamelContext.- Returns:
- the name
-
getDescription
String getDescription()
Gets the description of this CamelContext.- Returns:
- the description, or null if no description has been set.
-
getNameStrategy
CamelContextNameStrategy getNameStrategy()
Gets the current name strategy- Returns:
- name strategy
-
setNameStrategy
void setNameStrategy(CamelContextNameStrategy nameStrategy)
Sets a custom name strategy- Parameters:
nameStrategy
- name strategy
-
getManagementNameStrategy
ManagementNameStrategy getManagementNameStrategy()
Gets the current management name strategy- Returns:
- management name strategy
-
setManagementNameStrategy
void setManagementNameStrategy(ManagementNameStrategy nameStrategy)
Sets a custom management name strategy- Parameters:
nameStrategy
- name strategy
-
getManagementName
String getManagementName()
Gets the name thisCamelContext
was registered in JMX. The reason that aCamelContext
can have a different name in JMX is the fact to remedy for name clash in JMX when having multipleCamelContext
s in the same JVM. Camel will automatic reassign and use a free name to avoid failing to start.- Returns:
- the management name
-
setManagementName
void setManagementName(String name)
Sets the name thisCamelContext
will be registered in JMX.
-
getVersion
String getVersion()
Gets the version of the this CamelContext.- Returns:
- the version
-
getUptime
String getUptime()
Gets the uptime in a human readable format- Returns:
- the uptime in days/hours/minutes
-
getUptimeMillis
long getUptimeMillis()
Gets the uptime in milli seconds- Returns:
- the uptime in millis seconds
-
getStartDate
Date getStartDate()
Gets the date and time Camel was started up.
-
addService
void addService(Object object) throws Exception
Adds a service to this CamelContext, which allows this CamelContext to control the lifecycle, ensuring the service is stopped when the CamelContext stops. The service will also haveCamelContext
injected if itsCamelContextAware
. The service will also be enlisted in JMX for management (if JMX is enabled). The service will be started, if its not already started.- Parameters:
object
- the service- Throws:
Exception
- can be thrown when starting the service
-
addService
void addService(Object object, boolean stopOnShutdown) throws Exception
Adds a service to this CamelContext. The service will also haveCamelContext
injected if itsCamelContextAware
. 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.- Parameters:
object
- the servicestopOnShutdown
- whether to stop the service when this CamelContext shutdown.- Throws:
Exception
- can be thrown when starting the service
-
addService
void addService(Object object, boolean stopOnShutdown, boolean forceStart) throws Exception
Adds a service to this CamelContext. The service will also haveCamelContext
injected if itsCamelContextAware
. 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.- Parameters:
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 usingdeferStartService(Object, boolean)
- Throws:
Exception
- can be thrown when starting the service
-
addPrototypeService
void addPrototypeService(Object object) throws Exception
Adds a service to this CamelContext (prototype scope). The service will also haveCamelContext
injected if itsCamelContextAware
. The service will be started, if its not already started.- Parameters:
object
- the service- Throws:
Exception
- can be thrown when starting the service
-
removeService
boolean removeService(Object object) throws Exception
Removes a service from this CamelContext. The service is assumed to have been previously added usingaddService(Object)
method. This method will not change the service lifecycle.- Parameters:
object
- the service- Returns:
- true if the service was removed, false if no service existed
- Throws:
Exception
- can be thrown if error removing the service
-
hasService
boolean hasService(Object object)
Has the given service already been added to this CamelContext?- Parameters:
object
- the service- Returns:
- true if already added, false if not.
-
hasService
<T> T hasService(Class<T> type)
Has the given service type already been added to this CamelContext?- Parameters:
type
- the class type- Returns:
- the service instance or null if not already added.
-
hasServices
<T> Set<T> hasServices(Class<T> type)
Has the given service type already been added to this CamelContext?- Parameters:
type
- the class type- Returns:
- the services instance or empty set.
-
deferStartService
void deferStartService(Object object, boolean stopOnShutdown) throws Exception
Defers starting the service untilCamelContext
is (almost started) or started and has initialized all its prior services and routes. IfCamelContext
is already started then the service is started immediately.- Parameters:
object
- the servicestopOnShutdown
- whether to stop the service when this CamelContext shutdown. Setting this to true will keep a reference to the service in thisCamelContext
until the CamelContext is stopped. So do not use it for short lived services.- Throws:
Exception
- can be thrown when starting the service, which is only attempted ifCamelContext
has already been started when calling this method.
-
addStartupListener
void addStartupListener(StartupListener listener) throws Exception
Adds the given listener to be invoked whenCamelContext
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 theCamelContext
has already been started, see theStartupListener.onCamelContextStarted(CamelContext, boolean)
method.- Parameters:
listener
- the listener- Throws:
Exception
- can be thrown ifCamelContext
is already started and the listener is invoked and cause an exception to be thrown
-
addComponent
void addComponent(String componentName, Component component)
Adds a component to the context. Notice the component will be auto-started if Camel is already started.- Parameters:
componentName
- the name the component is registered ascomponent
- the component
-
hasComponent
Component hasComponent(String componentName)
Is the given component already registered?- Parameters:
componentName
- the name of the component- Returns:
- the registered Component or null if not registered
-
getComponent
Component getComponent(String componentName)
Gets a component from the CamelContext by name. Notice the returned component will be auto-started. If you do not intend to do that then usegetComponent(String, boolean, boolean)
.- Parameters:
componentName
- the name of the component- Returns:
- the component
-
getComponent
Component getComponent(String name, boolean autoCreateComponents)
Gets a component from the CamelContext by name. Notice the returned component will be auto-started. If you do not intend to do that then usegetComponent(String, boolean, boolean)
.- Parameters:
name
- the name of the componentautoCreateComponents
- whether or not the component should be lazily created if it does not already exist- Returns:
- the component
-
getComponent
Component getComponent(String name, boolean autoCreateComponents, boolean autoStart)
Gets a component from the CamelContext by name.- Parameters:
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 ifCamelContext
is already started.- Returns:
- the component
-
getComponent
<T extends Component> T getComponent(String name, Class<T> componentType)
Gets a component from the CamelContext by name and specifying the expected type of component.- Parameters:
name
- the name to lookupcomponentType
- the expected type- Returns:
- the component
-
getComponentNames
Set<String> getComponentNames()
Gets a readonly list of names of the components currently registered- Returns:
- a readonly list with the names of the components
-
removeComponent
Component removeComponent(String componentName)
Removes a previously added component. The component being removed will be stopped first.- Parameters:
componentName
- the component name to remove- Returns:
- the previously added component or null if it had not been previously added.
-
getEndpointRegistry
EndpointRegistry<? extends ValueHolder<String>> getEndpointRegistry()
Gets theEndpointRegistry
-
getEndpoint
Endpoint getEndpoint(String uri)
Resolves the given name to anEndpoint
of the specified type. If the name has a singleton endpoint registered, then the singleton is returned. Otherwise, a newEndpoint
is created and registered in theEndpointRegistry
.- Parameters:
uri
- the URI of the endpoint- Returns:
- the endpoint
-
getEndpoint
Endpoint getEndpoint(String uri, Map<String,Object> parameters)
Resolves the given name to anEndpoint
of the specified type. If the name has a singleton endpoint registered, then the singleton is returned. Otherwise, a newEndpoint
is created and registered in theEndpointRegistry
.- Parameters:
uri
- the URI of the endpointparameters
- the parameters to customize the endpoint- Returns:
- the endpoint
-
getEndpoint
<T extends Endpoint> T getEndpoint(String name, Class<T> endpointType)
Resolves the given name to anEndpoint
of the specified type. If the name has a singleton endpoint registered, then the singleton is returned. Otherwise, a newEndpoint
is created and registered in theEndpointRegistry
.- Parameters:
name
- the name of the endpointendpointType
- the expected type- Returns:
- the endpoint
-
getEndpoints
Collection<Endpoint> getEndpoints()
Returns a read-onlyCollection
of all of the endpoints from theEndpointRegistry
- Returns:
- all endpoints
-
getEndpointMap
@Deprecated Map<String,Endpoint> getEndpointMap()
Deprecated.Returns a newMap
containing all of the endpoints from theEndpointRegistry
- Returns:
- map of endpoints
-
hasEndpoint
Endpoint hasEndpoint(String uri)
Is the given endpoint already registered in theEndpointRegistry
- Parameters:
uri
- the URI of the endpoint- Returns:
- the registered endpoint or null if not registered
-
addEndpoint
Endpoint addEndpoint(String uri, Endpoint endpoint) throws Exception
Adds and starts the endpoint to theEndpointRegistry
using the given URI.- Parameters:
uri
- the URI to be used to resolve this endpointendpoint
- the endpoint to be started and added to the registry- Returns:
- the old endpoint that was previously registered or null if none was registered
- Throws:
Exception
- if the new endpoint could not be started or the old endpoint could not be stopped
-
removeEndpoint
void removeEndpoint(Endpoint endpoint) throws Exception
Removes the endpoint from theEndpointRegistry
. The endpoint being removed will be stopped first.- Parameters:
endpoint
- the endpoint- Throws:
Exception
- if the endpoint could not be stopped
-
removeEndpoints
Collection<Endpoint> removeEndpoints(String pattern) throws Exception
Removes all endpoints with the given URI from theEndpointRegistry
. The endpoints being removed will be stopped first.- Parameters:
pattern
- an uri or pattern to match- Returns:
- a collection of endpoints removed which could be empty if there are no endpoints found for the given pattern
- Throws:
Exception
- if at least one endpoint could not be stopped- See Also:
for pattern
-
getGlobalEndpointConfiguration
GlobalEndpointConfiguration getGlobalEndpointConfiguration()
Gets the global endpoint configuration, where you can configure common endpoint options.
-
setRouteController
void setRouteController(RouteController routeController)
Sets a customRouteController
to use- Parameters:
routeController
- the route controller
-
getRouteController
RouteController getRouteController()
Gets theRouteController
- Returns:
- the route controller.
-
getRoutes
List<Route> getRoutes()
Returns the current routes in this CamelContext- Returns:
- the current routes
-
getRoutesSize
int getRoutesSize()
Returns the total number of routes in this CamelContext
-
getRoute
Route getRoute(String id)
Gets the route with the given id- Parameters:
id
- id of the route- Returns:
- the route or null if not found
-
getProcessor
Processor getProcessor(String id)
Gets the processor from any of the routes which with the given id- Parameters:
id
- id of the processor- Returns:
- the processor or null if not found
-
getProcessor
<T extends Processor> T getProcessor(String id, Class<T> type)
Gets the processor from any of the routes which with the given id- Parameters:
id
- id of the processortype
- the processor type- Returns:
- the processor or null if not found
- Throws:
ClassCastException
- is thrown if the type is not correct type
-
addRoutes
void addRoutes(RoutesBuilder builder) throws Exception
Adds a collection of routes to this CamelContext using the given builder to build them. Important: The added routes will only be started, ifCamelContext
is already started. You may want to check the state ofCamelContext
before adding the routes, using theCamelContextLifecycle.getStatus()
method. Important: Each route in the sameCamelContext
must have an unique route id. If you use the API fromCamelContext
ororg.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.- Parameters:
builder
- the builder which will create the routes and add them to this CamelContext- Throws:
Exception
- if the routes could not be created for whatever reason
-
addTemplatedRoutes
void addTemplatedRoutes(RoutesBuilder builder) throws Exception
Adds the templated routes from the routes builder. For example in Java DSL you can useorg.apache.camel.builder.TemplatedRouteBuilder
.- Parameters:
builder
- the builder which has templated routes- Throws:
Exception
- if the routes could not be created for whatever reason
-
addRoutesConfigurations
void addRoutesConfigurations(RouteConfigurationsBuilder builder) throws Exception
Adds the routes configurations (global configuration for all routes) from the routes builder.- Parameters:
builder
- the builder which has routes configurations- Throws:
Exception
- if the routes configurations could not be created for whatever reason
-
removeRoute
boolean removeRoute(String routeId) throws Exception
Removes the given route (the route must be stopped before it can be removed). A route which is removed will be unregistered from JMX, have its services stopped/shutdown and the route definition etc. will also be removed. All the resources related to the route will be stopped and cleared. Important: When removing a route, theEndpoint
s which are in the static cache ofEndpointRegistry
and are only used by the route (not used by other routes) will also be removed. ButEndpoint
s which may have been created as part of routing messages by the route, and those endpoints are enlisted in the dynamic cache ofEndpointRegistry
are not removed. To remove those dynamic kind of endpoints, use theremoveEndpoints(String)
method. If not removing those endpoints, they will be kept in the dynamic cache ofEndpointRegistry
, 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.- Parameters:
routeId
- the route id- Returns:
- true if the route was removed, false if the route could not be removed because it's not stopped
- Throws:
Exception
- is thrown if the route could not be shutdown for whatever reason
-
addRouteFromTemplate
@Deprecated String addRouteFromTemplate(String routeId, String routeTemplateId, Map<String,Object> parameters) throws Exception
Deprecated.Adds a new route from a given route template. Camel end users should favour usingorg.apache.camel.builder.TemplatedRouteBuilder
which is a fluent builder with more functionality than this API.- Parameters:
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 route- Returns:
- the id of the route added (for example when an id was auto assigned)
- Throws:
Exception
- is thrown if error creating and adding the new route
-
addRouteFromTemplate
String addRouteFromTemplate(String routeId, String routeTemplateId, String prefixId, Map<String,Object> parameters) throws Exception
Adds a new route from a given route template. Camel end users should favour usingorg.apache.camel.builder.TemplatedRouteBuilder
which is a fluent builder with more functionality than this API.- Parameters:
routeId
- the id of the new route to add (optional)routeTemplateId
- the id of the route template (mandatory)prefixId
- prefix to use for all node ids (not route id). Use null for no prefix. (optional)parameters
- parameters to use for the route template when creating the new route- Returns:
- the id of the route added (for example when an id was auto assigned)
- Throws:
Exception
- is thrown if error creating and adding the new route
-
addRouteFromTemplate
@Deprecated String addRouteFromTemplate(String routeId, String routeTemplateId, RouteTemplateContext routeTemplateContext) throws Exception
Adds a new route from a given route template. Camel end users should favour usingorg.apache.camel.builder.TemplatedRouteBuilder
which is a fluent builder with more functionality than this API.- Parameters:
routeId
- the id of the new route to add (optional)routeTemplateId
- the id of the route template (mandatory)routeTemplateContext
- the route template context (mandatory)- Returns:
- the id of the route added (for example when an id was auto assigned)
- Throws:
Exception
- is thrown if error creating and adding the new route
-
addRouteFromTemplate
String addRouteFromTemplate(String routeId, String routeTemplateId, String prefixId, RouteTemplateContext routeTemplateContext) throws Exception
Adds a new route from a given route template. Camel end users should favour usingorg.apache.camel.builder.TemplatedRouteBuilder
which is a fluent builder with more functionality than this API.- Parameters:
routeId
- the id of the new route to add (optional)routeTemplateId
- the id of the route template (mandatory)prefixId
- prefix to use for all node ids (not route id). Use null for no prefix. (optional)routeTemplateContext
- the route template context (mandatory)- Returns:
- the id of the route added (for example when an id was auto assigned)
- Throws:
Exception
- is thrown if error creating and adding the new route
-
removeRouteTemplates
void removeRouteTemplates(String pattern) throws Exception
Removes the route templates matching the pattern- Parameters:
pattern
- pattern, such as * for all, or foo* to remove all foo templates- Throws:
Exception
- is thrown if error during removing route templates
-
addRoutePolicyFactory
void addRoutePolicyFactory(RoutePolicyFactory routePolicyFactory)
Adds the given route policy factory- Parameters:
routePolicyFactory
- the factory
-
getRoutePolicyFactories
List<RoutePolicyFactory> getRoutePolicyFactories()
Gets the route policy factories- Returns:
- the list of current route policy factories
-
setRestConfiguration
void setRestConfiguration(RestConfiguration restConfiguration)
Sets a customRestConfiguration
- Parameters:
restConfiguration
- the REST configuration
-
getRestConfiguration
RestConfiguration getRestConfiguration()
Gets the default REST configuration- Returns:
- the configuration, or null if none has been configured.
-
setVaultConfiguration
void setVaultConfiguration(VaultConfiguration vaultConfiguration)
Sets a customVaultConfiguration
- Parameters:
vaultConfiguration
- the vault configuration
-
getVaultConfiguration
VaultConfiguration getVaultConfiguration()
Gets the vault configuration- Returns:
- the configuration, or null if none has been configured.
-
getRestRegistry
RestRegistry getRestRegistry()
Gets theRestRegistry
to use
-
setRestRegistry
void setRestRegistry(RestRegistry restRegistry)
Sets a customRestRegistry
to use.
-
getTypeConverter
TypeConverter getTypeConverter()
Returns the type converter used to coerce types from one type to another. Notice that thisCamelContext
should be at least initialized before you can get the type converter.- Returns:
- the converter
-
getTypeConverterRegistry
TypeConverterRegistry getTypeConverterRegistry()
Returns the type converter registry where type converters can be added or looked up- Returns:
- the type converter registry
-
setTypeConverterRegistry
void setTypeConverterRegistry(TypeConverterRegistry typeConverterRegistry)
Configures the type converter registry to use, where type converters can be added or looked up.- Parameters:
typeConverterRegistry
- the registry to use
-
getRegistry
Registry getRegistry()
Returns the registry used to lookup components by name and type such as SimpleRegistry, Spring ApplicationContext, JNDI, or the OSGi Service Registry.- Returns:
- the registry
-
getRegistry
<T> T getRegistry(Class<T> type)
Returns the registry used to lookup components by name and as the given type- Parameters:
type
- the registry type such as org.apache.camel.impl.JndiRegistry- Returns:
- the registry, or null if the given type was not found as a registry implementation
-
getInjector
Injector getInjector()
Returns the injector used to instantiate objects by type- Returns:
- the injector
-
setInjector
void setInjector(Injector injector)
Sets the injector to use
-
getLifecycleStrategies
List<LifecycleStrategy> getLifecycleStrategies()
Returns the lifecycle strategies used to handle lifecycle notifications- Returns:
- the lifecycle strategies
-
addLifecycleStrategy
void addLifecycleStrategy(LifecycleStrategy lifecycleStrategy)
Adds the given lifecycle strategy to be used.- Parameters:
lifecycleStrategy
- the strategy
-
resolveLanguage
Language resolveLanguage(String language) throws NoSuchLanguageException
Resolves a language for creating expressions- Parameters:
language
- name of the language- Returns:
- the resolved language
- Throws:
NoSuchLanguageException
- is thrown if language could not be resolved
-
resolvePropertyPlaceholders
String resolvePropertyPlaceholders(String text)
Parses the given text and resolve any property placeholders - using {{key}}. Important: If resolving placeholders on an endpoint uri, then you SHOULD use EndpointHelper#resolveEndpointUriPropertyPlaceholders instead.- Parameters:
text
- the text such as an endpoint uri or the likes- Returns:
- the text with resolved property placeholders
- Throws:
IllegalArgumentException
- is thrown if property placeholders was used and there was an error resolving them
-
getPropertiesComponent
PropertiesComponent getPropertiesComponent()
Returns the configured properties component or create one if none has been configured.- Returns:
- the properties component
-
setPropertiesComponent
void setPropertiesComponent(PropertiesComponent propertiesComponent)
Sets a custom properties component to be used.
-
getLanguageNames
Set<String> getLanguageNames()
Gets a readonly list with the names of the languages currently registered.- Returns:
- a readonly list with the names of the languages
-
createProducerTemplate
ProducerTemplate createProducerTemplate()
Creates a newProducerTemplate
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 callService.stop()
when you are done using the template, to clean up any resources. Will use cache size defined in Camel property with keyExchange.MAXIMUM_CACHE_POOL_SIZE
. If no key was defined then it will fallback to a default size of 1000. You can also use theProducerTemplate.setMaximumCacheSize(int)
method to use a custom value before starting the template.- Returns:
- the template
- Throws:
RuntimeCamelException
- is thrown if error starting the template
-
createProducerTemplate
ProducerTemplate createProducerTemplate(int maximumCacheSize)
Creates a newProducerTemplate
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 callService.stop()
when you are done using the template, to clean up any resources.- Parameters:
maximumCacheSize
- the maximum cache size- Returns:
- the template
- Throws:
RuntimeCamelException
- is thrown if error starting the template
-
createFluentProducerTemplate
FluentProducerTemplate createFluentProducerTemplate()
Creates a newFluentProducerTemplate
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 callService.stop()
when you are done using the template, to clean up any resources. Will use cache size defined in Camel property with keyExchange.MAXIMUM_CACHE_POOL_SIZE
. If no key was defined then it will fallback to a default size of 1000. You can also use theFluentProducerTemplate.setMaximumCacheSize(int)
method to use a custom value before starting the template.- Returns:
- the template
- Throws:
RuntimeCamelException
- is thrown if error starting the template
-
createFluentProducerTemplate
FluentProducerTemplate createFluentProducerTemplate(int maximumCacheSize)
Creates a newFluentProducerTemplate
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 callService.stop()
when you are done using the template, to clean up any resources.- Parameters:
maximumCacheSize
- the maximum cache size- Returns:
- the template
- Throws:
RuntimeCamelException
- is thrown if error starting the template
-
createConsumerTemplate
ConsumerTemplate createConsumerTemplate()
Creates a newConsumerTemplate
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 callService.stop()
when you are done using the template, to clean up any resources. Will use cache size defined in Camel property with keyExchange.MAXIMUM_CACHE_POOL_SIZE
. If no key was defined then it will fallback to a default size of 1000. You can also use theConsumerTemplate.setMaximumCacheSize(int)
method to use a custom value before starting the template.- Returns:
- the template
- Throws:
RuntimeCamelException
- is thrown if error starting the template
-
createConsumerTemplate
ConsumerTemplate createConsumerTemplate(int maximumCacheSize)
Creates a newConsumerTemplate
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 callService.stop()
when you are done using the template, to clean up any resources.- Parameters:
maximumCacheSize
- the maximum cache size- Returns:
- the template
- Throws:
RuntimeCamelException
- is thrown if error starting the template
-
resolveDataFormat
DataFormat resolveDataFormat(String name)
Resolve an existing data format, or creates a new by the given its name- Parameters:
name
- the data format name or a reference to it in theRegistry
- Returns:
- the resolved data format, or null if not found
-
createDataFormat
DataFormat createDataFormat(String name)
Creates a new instance of the given data format given its name.- Parameters:
name
- the data format name or a reference to a data format factory in theRegistry
- Returns:
- the created data format, or null if not found
-
getDataFormatNames
Set<String> getDataFormatNames()
Gets a readonly list of names of the data formats currently registered- Returns:
- a readonly list with the names of the data formats
-
resolveTransformer
Transformer resolveTransformer(String model)
Resolve a transformer given a scheme- Parameters:
model
- data model name.- Returns:
- the resolved transformer, or null if not found
-
resolveTransformer
Transformer resolveTransformer(DataType from, DataType to)
Resolve a transformer given from/to data type.- Parameters:
from
- from data typeto
- to data type- Returns:
- the resolved transformer, or null if not found
-
getTransformerRegistry
TransformerRegistry getTransformerRegistry()
Gets theTransformerRegistry
- Returns:
- the TransformerRegistry
-
resolveValidator
Validator resolveValidator(DataType type)
Resolve a validator given from/to data type.- Parameters:
type
- the data type- Returns:
- the resolved validator, or null if not found
-
getValidatorRegistry
ValidatorRegistry getValidatorRegistry()
Gets theValidatorRegistry
- Returns:
- the ValidatorRegistry
-
setGlobalOptions
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. For property placeholders useresolvePropertyPlaceholders(String)
method and see more details at the property placeholder documentation.- Parameters:
globalOptions
- global options that can be referenced in the camel context
-
getGlobalOptions
Map<String,String> getGlobalOptions()
Gets 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. For property placeholders useresolvePropertyPlaceholders(String)
method and see more details at the property placeholder documentation.- Returns:
- global options for this context
-
getGlobalOption
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. For property placeholders useresolvePropertyPlaceholders(String)
method and see more details at the property placeholder documentation.- Returns:
- the string value of the global option
-
getClassResolver
ClassResolver getClassResolver()
Returns the class resolver to be used for loading/lookup of classes.- Returns:
- the resolver
-
setClassResolver
void setClassResolver(ClassResolver resolver)
Sets the class resolver to be use- Parameters:
resolver
- the resolver
-
getManagementStrategy
ManagementStrategy getManagementStrategy()
Gets the management strategy- Returns:
- the management strategy
-
setManagementStrategy
void setManagementStrategy(ManagementStrategy strategy)
Sets the management strategy to use- Parameters:
strategy
- the management strategy
-
disableJMX
void disableJMX() throws IllegalStateException
Disables using JMX asManagementStrategy
. Important: This method must be called before theCamelContext
is started.- Throws:
IllegalStateException
- is thrown if theCamelContext
is not in stopped state.
-
getInflightRepository
InflightRepository getInflightRepository()
Gets the inflight repository- Returns:
- the repository
-
setInflightRepository
void setInflightRepository(InflightRepository repository)
Sets a custom inflight repository to use- Parameters:
repository
- the repository
-
getApplicationContextClassLoader
ClassLoader getApplicationContextClassLoader()
Gets the application CamelContext class loader which may be helpful for running camel in other containers- Returns:
- the application CamelContext class loader
-
setApplicationContextClassLoader
void setApplicationContextClassLoader(ClassLoader classLoader)
Sets the application CamelContext class loader- Parameters:
classLoader
- the class loader
-
getShutdownStrategy
ShutdownStrategy getShutdownStrategy()
Gets the current shutdown strategy. The shutdown strategy is not intended for Camel end users to use for stopping routes. Instead useRouteController
viaCamelContext
.- Returns:
- the strategy
-
setShutdownStrategy
void setShutdownStrategy(ShutdownStrategy shutdownStrategy)
Sets a custom shutdown strategy- Parameters:
shutdownStrategy
- the custom strategy
-
getExecutorServiceManager
ExecutorServiceManager getExecutorServiceManager()
Gets the currentExecutorServiceManager
- Returns:
- the manager
-
setExecutorServiceManager
void setExecutorServiceManager(ExecutorServiceManager executorServiceManager)
Sets a customExecutorServiceManager
- Parameters:
executorServiceManager
- the custom manager
-
getMessageHistoryFactory
MessageHistoryFactory getMessageHistoryFactory()
Gets the currentMessageHistoryFactory
- Returns:
- the factory
-
setMessageHistoryFactory
void setMessageHistoryFactory(MessageHistoryFactory messageHistoryFactory)
Sets a customMessageHistoryFactory
- Parameters:
messageHistoryFactory
- the custom factory
-
setDebugger
void setDebugger(Debugger debugger)
Sets a customDebugger
- Parameters:
debugger
- the debugger
-
setTracingStandby
void setTracingStandby(boolean tracingStandby)
Whether to set tracing on standby. If on standby then the tracer is installed and made available. Then the tracer can be enabled later at runtime via JMX or viaTracer.setEnabled(boolean)
.
-
isTracingStandby
boolean isTracingStandby()
Whether to set tracing on standby. If on standby then the tracer is installed and made available. Then the tracer can be enabled later at runtime via JMX or viaTracer.setEnabled(boolean)
.
-
setBacklogTracingStandby
void setBacklogTracingStandby(boolean backlogTracingStandby)
Whether to set backlog tracing on standby. If on standby then the backlog tracer is installed and made available. Then the backlog tracer can be enabled later at runtime via JMX or via Java API.
-
isBacklogTracingStandby
boolean isBacklogTracingStandby()
Whether to set backlog tracing on standby. If on standby then the backlog tracer is installed and made available. Then the backlog tracer can be enabled later at runtime via JMX or via Java API.
-
getUuidGenerator
UuidGenerator getUuidGenerator()
Gets the currentUuidGenerator
- Returns:
- the uuidGenerator
-
setUuidGenerator
void setUuidGenerator(UuidGenerator uuidGenerator)
Sets a customUuidGenerator
(should only be set once)- Parameters:
uuidGenerator
- the UUID Generator
-
isLoadTypeConverters
Boolean isLoadTypeConverters()
Whether to load custom type converters by scanning classpath. This is used for backwards compatibility with Camel 2.x. Its recommended to migrate to use fast type converter loading by setting @Converter(loader = true) on your custom type converter classes.
-
setLoadTypeConverters
void setLoadTypeConverters(Boolean loadTypeConverters)
Whether to load custom type converters by scanning classpath. This is used for backwards compatibility with Camel 2.x. Its recommended to migrate to use fast type converter loading by setting @Converter(loader = true) on your custom type converter classes.- Parameters:
loadTypeConverters
- whether to load custom type converters using classpath scanning.
-
isLoadHealthChecks
Boolean isLoadHealthChecks()
Whether to load custom health checks by scanning classpath.
-
setLoadHealthChecks
void setLoadHealthChecks(Boolean loadHealthChecks)
Whether to load custom health checks by scanning classpath.
-
isSourceLocationEnabled
Boolean isSourceLocationEnabled()
Whether to capture precise source location:line-number for all EIPs in Camel routes. Enabling this will impact parsing Java based routes (also Groovy, Kotlin, etc.) on startup as this usesStackTraceElement
to calculate the location from the Camel route, which comes with a performance cost. This only impact startup, not the performance of the routes at runtime.
-
setSourceLocationEnabled
void setSourceLocationEnabled(Boolean sourceLocationEnabled)
Whether to capture precise source location:line-number for all EIPs in Camel routes. Enabling this will impact parsing Java based routes (also Groovy, Kotlin, etc.) on startup as this usesStackTraceElement
to calculate the location from the Camel route, which comes with a performance cost. This only impact startup, not the performance of the routes at runtime.
-
isModeline
Boolean isModeline()
Whether camel-k style modeline is also enabled when not using camel-k. Enabling this allows to use a camel-k like experience by being able to configure various settings using modeline directly in your route source code.
-
setModeline
void setModeline(Boolean modeline)
Whether camel-k style modeline is also enabled when not using camel-k. Enabling this allows to use a camel-k like experience by being able to configure various settings using modeline directly in your route source code.
-
isDevConsole
Boolean isDevConsole()
Whether to enable developer console (requires camel-console on classpath). The developer console is only for assisting during development. This is NOT for production usage.
-
setDevConsole
void setDevConsole(Boolean loadDevConsoles)
Whether to enable developer console (requires camel-console on classpath) The developer console is only for assisting during development. This is NOT for production usage.
-
isTypeConverterStatisticsEnabled
Boolean isTypeConverterStatisticsEnabled()
Whether or not type converter statistics is enabled. By default the type converter utilization statistics is disabled. Notice: If enabled then there is a slight performance impact under very heavy load.- Returns:
- true if enabled, false if disabled (default).
-
setTypeConverterStatisticsEnabled
void setTypeConverterStatisticsEnabled(Boolean typeConverterStatisticsEnabled)
Sets whether or not type converter statistics is enabled. By default the type converter utilization statistics is disabled. Notice: If enabled then there is a slight performance impact under very heavy load. You can enable/disable the statistics at runtime using the {@link org.apache.camel.spi.TypeConverterRegistry#getStatistics()#setTypeConverterStatisticsEnabled(Boolean)} method, or from JMX on theorg.apache.camel.api.management.mbean.ManagedTypeConverterRegistryMBean
mbean.- Parameters:
typeConverterStatisticsEnabled
- true to enable, false to disable
-
isUseMDCLogging
Boolean isUseMDCLogging()
Whether or not MDC logging is being enabled.- Returns:
- true if MDC logging is enabled
-
setUseMDCLogging
void setUseMDCLogging(Boolean useMDCLogging)
Set whether MDC is enabled.- Parameters:
useMDCLogging
- true to enable MDC logging, false to disable
-
getMDCLoggingKeysPattern
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. Setting this pattern to * will propagate all custom keys. Or setting the pattern to foo*,bar* will propagate any keys starting with either foo or bar. Notice that a set of standard Camel MDC keys are always propagated which starts with camel. as key name. The match rules are applied in this order (case insensitive):- exact match, returns true
- wildcard match (pattern ends with a * and the name starts with the pattern), returns true
- regular expression match, returns true
- otherwise returns false
-
setMDCLoggingKeysPattern
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. Setting this pattern to * will propagate all custom keys. Or setting the pattern to foo*,bar* will propagate any keys starting with either foo or bar. Notice that a set of standard Camel MDC keys are always propagated which starts with camel. as key name. The match rules are applied in this order (case insensitive):- exact match, returns true
- wildcard match (pattern ends with a * and the name starts with the pattern), returns true
- regular expression match, returns true
- otherwise returns false
- Parameters:
pattern
- the pattern
-
getTracingLoggingFormat
String getTracingLoggingFormat()
To use a custom tracing logging format. The default format (arrow, routeId, label) is: %-4.4s [%-12.12s] [%-33.33s]
-
setTracingLoggingFormat
void setTracingLoggingFormat(String format)
To use a custom tracing logging format. The default format (arrow, routeId, label) is: %-4.4s [%-12.12s] [%-33.33s]- Parameters:
format
- the logging format
-
isDumpRoutes
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. This is intended for trouble shooting or to assist during development. Sensitive information that may be configured in the route endpoints could potentially be included in the dump output and is therefore not recommended to be used for production usage. This requires to have camel-xml-jaxb on the classpath to be able to dump the routes as XML.- Returns:
- true if dumping is enabled
-
setDumpRoutes
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. This is intended for trouble shooting or to assist during development. Sensitive information that may be configured in the route endpoints could potentially be included in the dump output and is therefore not recommended to be used for production usage. This requires to have camel-xml-jaxb on the classpath to be able to dump the routes as XML.- Parameters:
dumpRoutes
- true to enable dumping routes.
-
isUseDataType
Boolean isUseDataType()
Whether to enable using data type on Camel messages. Data type are automatic turned on if one ore more routes has been explicit configured with input and output types. Otherwise data type is default off.- Returns:
- true if data type is enabled
-
setUseDataType
void setUseDataType(Boolean useDataType)
Whether to enable using data type on Camel messages. Data type are automatic turned on if one ore more routes has been explicit configured with input and output types. Otherwise data type is default off.- Parameters:
useDataType
- true to enable data type on Camel messages.
-
isUseBreadcrumb
Boolean isUseBreadcrumb()
Whether or not breadcrumb is enabled.- Returns:
- true if breadcrumb is enabled
-
setUseBreadcrumb
void setUseBreadcrumb(Boolean useBreadcrumb)
Set whether breadcrumb is enabled.- Parameters:
useBreadcrumb
- true to enable breadcrumb, false to disable
-
getStreamCachingStrategy
StreamCachingStrategy getStreamCachingStrategy()
Gets theStreamCachingStrategy
to use.
-
setStreamCachingStrategy
void setStreamCachingStrategy(StreamCachingStrategy streamCachingStrategy)
Sets a customStreamCachingStrategy
to use.
-
getRuntimeEndpointRegistry
RuntimeEndpointRegistry getRuntimeEndpointRegistry()
Gets theRuntimeEndpointRegistry
to use, or null if none is in use.
-
setRuntimeEndpointRegistry
void setRuntimeEndpointRegistry(RuntimeEndpointRegistry runtimeEndpointRegistry)
Sets a customRuntimeEndpointRegistry
to use.
-
setSSLContextParameters
void setSSLContextParameters(SSLContextParameters sslContextParameters)
Sets the global SSL context parameters.
-
getSSLContextParameters
SSLContextParameters getSSLContextParameters()
Gets the global SSL context parameters if configured.
-
setStartupSummaryLevel
void setStartupSummaryLevel(StartupSummaryLevel startupSummaryLevel)
Controls the level of information logged during startup (and shutdown) ofCamelContext
.
-
getStartupSummaryLevel
StartupSummaryLevel getStartupSummaryLevel()
Controls the level of information logged during startup (and shutdown) ofCamelContext
.
-
-