Package org.apache.camel
Interface ExtendedCamelContext
public interface ExtendedCamelContext
Extended
CamelContext
which contains the methods and APIs that are not primary intended for Camel end users
but for SPI, custom components, or more advanced used-cases with Camel.-
Method Summary
Modifier and TypeMethodDescriptionvoid
addBootstrap
(BootstrapCloseable bootstrap) Adds aBootstrapCloseable
task.<T> void
addContextPlugin
(Class<T> type, T module) Allows installation of custom plugins to the Camel context.void
addInterceptStrategy
(InterceptStrategy interceptStrategy) Adds the given interceptor strategyvoid
addLogListener
(LogListener listener) Adds aLogListener
.void
Internal API for adding routes.createErrorHandler
(Route route, Processor processor) Internal API for creating error handler.void
createProcessor
(String processorId) Method to signal toCamelContext
that creation of a given processor is in progress.void
createRoute
(String routeId) Method to signal toCamelContext
that the process to create routes is in progress.Package name to use as base (offset) for classpath scanning of RouteBuilder,TypeConverter
,CamelConfiguration
classes, and also classes annotated withConverter
, orBindToRegistry
.Gets the bootstrap FactoryFinder which will be used for the loading the factory class from META-INF.Gets the bootstrap FactoryFinder which will be used for the loading the factory class from META-INF in the given path.<T> T
getContextPlugin
(Class<T> type) Gets a plugin of the given type.Indicates whether current thread is creating a processor as part of starting Camel.Indicates whether current thread is creating a route as part of starting Camel.Gets the default FactoryFinder which will be used for the loading the factory class from META-INFdefault String
Resolves the given name to anEndpoint
of the specified type.getEndpoint
(NormalizedEndpointUri uri, Map<String, Object> parameters) Resolves the given name to anEndpoint
of the specified type.Gets theEndpointServiceRegistry
to use.getEndpointUriFactory
(String scheme) Gets theEndpointUriFactory
for the given component name.Gets the default error handler builder which is inherited by the routesGets the exchange factory to use.Gets the exchange factory manager to use.getFactoryFinder
(String path) Gets the FactoryFinder which will be used for the loading the factory class from META-INF in the given pathGets theHeadersMapFactory
to use.Gets the interceptor strategiesInternalRouteController
that are only used internally by Camel to perform basic route operations.Gets a list ofLogListener
(can be null if empty).Returns the management mbean assemblerdefault String
getName()
Gets the processor exchange factory to use.default String
The profile Camel should run as (dev,test,prod).Resolves the given name to anEndpoint
of the specified type (scope is prototype).Resolves the given name to anEndpoint
of the specified type (scope is prototype).Gets theReactiveExecutor
to use.default Registry
Returns the order in which the route inputs was started.default RuntimeCamelCatalog
Deprecated.Returns an unmodifiable list of the services registered currently in thisCamelContext
.Gets theStartupStepRecorder
to use.byte
TheCamelContext
have additional phases that are not defined inServiceStatus
and this method provides the phase ordinal value.Used during unit-testing where it is possible to specify a set of routes to exclude from discoveryIs the given endpoint already registered in theEndpointRegistry
boolean
Whether exchange event notification is applicable (possible).boolean
Indicates whether current thread is setting up route(s) as part of starting Camel.<T> void
lazyAddContextPlugin
(Class<T> type, Supplier<T> module) Allows lazy installation of custom plugins to the Camel context.normalizeUri
(String uri) Normalizes the given uri.void
registerEndpointCallback
(EndpointStrategy strategy) Registers acallback
to allow you to do custom logic when anEndpoint
is about to be registered to theEndpointRegistry
.void
removeRoute
(Route route) Internal API for removing routes.resolvePropertyPlaceholders
(String text, boolean keepUnresolvedOptional) Parses the given text and resolve any property placeholders - using {{key}}.void
setBasePackageScan
(String basePackageScan) Package name to use as base (offset) for classpath scanning of RouteBuilder,TypeConverter
,CamelConfiguration
classes, and also classes annotated withConverter
, orBindToRegistry
.void
setBootstrapFactoryFinder
(FactoryFinder factoryFinder) Sets the bootstrap FactoryFinder which will be used for the loading the factory class from META-INF.void
setDefaultFactoryFinder
(FactoryFinder factoryFinder) Sets the default FactoryFinder which will be used for the loading the factory class from META-INFvoid
setDescription
(String description) Sets the description of this Camel application.void
setEndpointServiceRegistry
(EndpointServiceRegistry endpointServiceRegistry) Sets a customEndpointServiceRegistry
to be used.void
setErrorHandlerFactory
(ErrorHandlerFactory errorHandlerFactory) Sets the default error handler builder which is inherited by the routesvoid
setEventNotificationApplicable
(boolean eventNotificationApplicable) Used as internal optimization in Camel to flag whether exchange event notification is applicable or not.void
setExchangeFactory
(ExchangeFactory exchangeFactory) Sets a custom exchange factory to use.void
setExchangeFactoryManager
(ExchangeFactoryManager exchangeFactoryManager) Sets a custom exchange factory manager to use.void
setHeadersMapFactory
(HeadersMapFactory factory) Sets a customHeadersMapFactory
to be used.void
setManagementMBeanAssembler
(ManagementMBeanAssembler managementMBeanAssembler) Sets the assembler to assemble aRequiredModelMBean
void
Sets the name (id) of this context.void
setProcessorExchangeFactory
(ProcessorExchangeFactory processorExchangeFactory) Sets a custom processor exchange factory to use.void
setProfile
(String profile) Sets the profile Camel should run as (dev,test,prod).void
setReactiveExecutor
(ReactiveExecutor reactiveExecutor) Sets a customReactiveExecutor
to be used.void
setRegistry
(Registry registry) Sets the registry Camel should use for looking up beans by name or type.void
setStartupStepRecorder
(StartupStepRecorder startupStepRecorder) Sets theStartupStepRecorder
to use.void
setupManagement
(Map<String, Object> options) Setup management according to whether JMX is enabled or disabled.void
setupRoutes
(boolean done) Method to signal toCamelContext
that the process to initialize setup routes is in progress.
-
Method Details
-
setName
Sets the name (id) of this context. This operation is mostly only used by different Camel runtimes such as camel-spring, camel-cdi, camel-spring-boot etc. Important: Setting the name should only be set before CamelContext is started.- Parameters:
name
- the name
-
getName
-
setDescription
Sets the description of this Camel application. -
getDescription
-
setProfile
Sets the profile Camel should run as (dev,test,prod). -
getProfile
The profile Camel should run as (dev,test,prod). Returns null if no profile has been set. -
setRegistry
Sets the registry Camel should use for looking up beans by name or type. This operation is mostly only used by different Camel runtimes such as camel-spring, camel-cdi, camel-spring-boot etc. Important: Setting the registry should only be set before CamelContext is started.- Parameters:
registry
- the registry such as DefaultRegistry or
-
setManagementMBeanAssembler
Sets the assembler to assemble aRequiredModelMBean
- Parameters:
managementMBeanAssembler
- the assembler to use
-
getRegistry
-
setupRoutes
void setupRoutes(boolean done) Method to signal toCamelContext
that the process to initialize setup routes is in progress.- Parameters:
done
- false to start the process, call again with true to signal its done.- See Also:
-
isSetupRoutes
boolean isSetupRoutes()Indicates whether current thread is setting up route(s) as part of starting Camel. This can be useful to know byLifecycleStrategy
or the likes, in case they need to react differently. As the startup procedure ofCamelContext
is slightly different when using plain Java versus camel-spring-xml, then we need to know when spring is setting up the routes, which can happen after theCamelContext
itself is in started state.- Returns:
- true if current thread is setting up route(s), or false if not.
- See Also:
-
createRoute
Method to signal toCamelContext
that the process to create routes is in progress.- Parameters:
routeId
- the current id of the route being created- See Also:
-
getCreateRoute
String getCreateRoute()Indicates whether current thread is creating a route as part of starting Camel. This can be useful to know byLifecycleStrategy
or the likes, in case they need to react differently.- Returns:
- the route id currently being created/started, or null if not.
- See Also:
-
createProcessor
Method to signal toCamelContext
that creation of a given processor is in progress.- Parameters:
processorId
- the current id of the processor being created- See Also:
-
getCreateProcessor
String getCreateProcessor()Indicates whether current thread is creating a processor as part of starting Camel. This can be useful to know byLifecycleStrategy
or the likes, in case they need to react differently.- Returns:
- the current id of the processor being created
- See Also:
-
registerEndpointCallback
Registers acallback
to allow you to do custom logic when anEndpoint
is about to be registered to theEndpointRegistry
. When a callback is registered it will be executed on the already registered endpoints allowing you to catch-up- Parameters:
strategy
- callback to be invoked
-
getPrototypeEndpoint
Resolves the given name to anEndpoint
of the specified type (scope is prototype). If the name has a singleton endpoint registered, then the singleton is returned. Otherwise, a newEndpoint
is created. The endpoint is NOT registered in theEndpointRegistry
as its prototype scoped, and therefore expected to be short lived and discarded after use (you must stop and shutdown the endpoint when no longer in use).- Parameters:
uri
- the URI of the endpoint- Returns:
- the endpoint
- See Also:
-
getPrototypeEndpoint
Resolves the given name to anEndpoint
of the specified type (scope is prototype). If the name has a singleton endpoint registered, then the singleton is returned. Otherwise, a newEndpoint
is created. The endpoint is NOT registered in theEndpointRegistry
as its prototype scoped, and therefore expected to be short lived and discarded after use (you must stop and shutdown the endpoint when no longer in use).- Parameters:
uri
- the URI of the endpoint- Returns:
- the endpoint
- See Also:
-
hasEndpoint
Is the given endpoint already registered in theEndpointRegistry
- Parameters:
uri
- the URI of the endpoint- Returns:
- the registered endpoint or null if not registered
-
getEndpoint
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
- See Also:
-
getEndpoint
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
- See Also:
-
normalizeUri
Normalizes the given uri.- Parameters:
uri
- the uri- Returns:
- a normalized uri
-
getRouteStartupOrder
List<RouteStartupOrder> getRouteStartupOrder()Returns the order in which the route inputs was started. The order may not be according to the startupOrder defined on the route. For example a route could be started manually later, or new routes added at runtime.- Returns:
- a list in the order how routes was started
-
addBootstrap
Adds aBootstrapCloseable
task. -
getServices
Returns an unmodifiable list of the services registered currently in thisCamelContext
. -
getExchangeFactory
ExchangeFactory getExchangeFactory()Gets the exchange factory to use. -
setExchangeFactory
Sets a custom exchange factory to use. -
getExchangeFactoryManager
ExchangeFactoryManager getExchangeFactoryManager()Gets the exchange factory manager to use. -
setExchangeFactoryManager
Sets a custom exchange factory manager to use. -
getProcessorExchangeFactory
ProcessorExchangeFactory getProcessorExchangeFactory()Gets the processor exchange factory to use. -
setProcessorExchangeFactory
Sets a custom processor exchange factory to use. -
getManagementMBeanAssembler
ManagementMBeanAssembler getManagementMBeanAssembler()Returns the management mbean assembler- Returns:
- the mbean assembler
-
getErrorHandlerFactory
ErrorHandlerFactory getErrorHandlerFactory()Gets the default error handler builder which is inherited by the routes- Returns:
- the builder
-
setErrorHandlerFactory
Sets the default error handler builder which is inherited by the routes- Parameters:
errorHandlerFactory
- the builder
-
getDefaultFactoryFinder
FactoryFinder getDefaultFactoryFinder()Gets the default FactoryFinder which will be used for the loading the factory class from META-INF- Returns:
- the default factory finder
- See Also:
-
setDefaultFactoryFinder
Sets the default FactoryFinder which will be used for the loading the factory class from META-INF -
getBootstrapFactoryFinder
FactoryFinder getBootstrapFactoryFinder()Gets the bootstrap FactoryFinder which will be used for the loading the factory class from META-INF. This bootstrap factory finder is only intended to be used during bootstrap (starting) CamelContext.- Returns:
- the bootstrap factory finder
- See Also:
-
setBootstrapFactoryFinder
Sets the bootstrap FactoryFinder which will be used for the loading the factory class from META-INF. This bootstrap factory finder is only intended to be used during bootstrap (starting) CamelContext.- See Also:
-
getBootstrapFactoryFinder
Gets the bootstrap FactoryFinder which will be used for the loading the factory class from META-INF in the given path. This bootstrap factory finder is only intended to be used during bootstrap (starting) CamelContext.- Parameters:
path
- the META-INF path- Returns:
- the bootstrap factory finder
- See Also:
-
getFactoryFinder
Gets the FactoryFinder which will be used for the loading the factory class from META-INF in the given path- Parameters:
path
- the META-INF path- Returns:
- the factory finder
-
addInterceptStrategy
Adds the given interceptor strategy- Parameters:
interceptStrategy
- the strategy
-
getInterceptStrategies
List<InterceptStrategy> getInterceptStrategies()Gets the interceptor strategies- Returns:
- the list of current interceptor strategies
-
setupManagement
Setup management according to whether JMX is enabled or disabled.- Parameters:
options
- optional parameters to configureManagementAgent
.
-
getLogListeners
Set<LogListener> getLogListeners()Gets a list ofLogListener
(can be null if empty). -
addLogListener
Adds aLogListener
. -
getHeadersMapFactory
HeadersMapFactory getHeadersMapFactory()Gets theHeadersMapFactory
to use. -
setHeadersMapFactory
Sets a customHeadersMapFactory
to be used. -
getReactiveExecutor
ReactiveExecutor getReactiveExecutor()Gets theReactiveExecutor
to use. -
setReactiveExecutor
Sets a customReactiveExecutor
to be used. -
getEndpointServiceRegistry
EndpointServiceRegistry getEndpointServiceRegistry()Gets theEndpointServiceRegistry
to use. -
setEndpointServiceRegistry
Sets a customEndpointServiceRegistry
to be used. -
isEventNotificationApplicable
boolean isEventNotificationApplicable()Whether exchange event notification is applicable (possible). This API is used internally in Camel as optimization. This is only for exchange events as this allows Camel to optimize to avoid preparing exchange events if there are no event listeners that are listening for exchange events. -
setEventNotificationApplicable
void setEventNotificationApplicable(boolean eventNotificationApplicable) Used as internal optimization in Camel to flag whether exchange event notification is applicable or not. This is only for exchange events as this allows Camel to optimize to avoid preparing exchange events if there are no event listeners that are listening for exchange events. -
getInternalRouteController
RouteController getInternalRouteController()InternalRouteController
that are only used internally by Camel to perform basic route operations. Do not use this as end user. -
getEndpointUriFactory
Gets theEndpointUriFactory
for the given component name. -
getRuntimeCamelCatalog
Deprecated.Gets theRuntimeCamelCatalog
if available on the classpath. -
getStartupStepRecorder
StartupStepRecorder getStartupStepRecorder()Gets theStartupStepRecorder
to use. -
setStartupStepRecorder
Sets theStartupStepRecorder
to use. -
addRoute
Internal API for adding routes. Do not use this as end user. -
removeRoute
Internal API for removing routes. Do not use this as end user. -
createErrorHandler
Internal API for creating error handler. Do not use this as end user.- Throws:
Exception
-
getTestExcludeRoutes
String getTestExcludeRoutes()Used during unit-testing where it is possible to specify a set of routes to exclude from discovery -
resolvePropertyPlaceholders
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 likeskeepUnresolvedOptional
- whether to keep placeholders that are optional and was unresolved- Returns:
- the text with resolved property placeholders
- Throws:
IllegalArgumentException
- is thrown if property placeholders was used and there was an error resolving them
-
getBasePackageScan
String getBasePackageScan()Package name to use as base (offset) for classpath scanning of RouteBuilder,TypeConverter
,CamelConfiguration
classes, and also classes annotated withConverter
, orBindToRegistry
.- Returns:
- the base package name (can be null if not configured)
-
setBasePackageScan
Package name to use as base (offset) for classpath scanning of RouteBuilder,TypeConverter
,CamelConfiguration
classes, and also classes annotated withConverter
, orBindToRegistry
.- Parameters:
basePackageScan
- the base package name
-
getStatusPhase
byte getStatusPhase()TheCamelContext
have additional phases that are not defined inServiceStatus
and this method provides the phase ordinal value. -
getContextPlugin
Gets a plugin of the given type.- Parameters:
type
- the type of the extension- Returns:
- the extension, or null if no extension has been installed.
-
addContextPlugin
Allows installation of custom plugins to the Camel context.- Parameters:
type
- the type of the extensionmodule
- the instance of the extension
-
lazyAddContextPlugin
Allows lazy installation of custom plugins to the Camel context.- Parameters:
type
- the type of the extensionmodule
- the instance of the extension
-