org.apache.camel.impl
Class DefaultCamelContext

java.lang.Object
  extended by org.apache.camel.support.ServiceSupport
      extended by org.apache.camel.impl.DefaultCamelContext
All Implemented Interfaces:
CamelContext, ModelCamelContext, RuntimeConfiguration, Service, ShutdownableService, StatefulService, SuspendableService

public class DefaultCamelContext
extends ServiceSupport
implements ModelCamelContext, SuspendableService

Represents the context used to configure routes and the policies to use.

Version:

Field Summary
 
Fields inherited from class org.apache.camel.support.ServiceSupport
shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending
 
Constructor Summary
DefaultCamelContext()
           
DefaultCamelContext(Context jndiContext)
          Creates the CamelContext using the given JNDI context as the registry
DefaultCamelContext(Registry registry)
          Creates the CamelContext using the given registry
 
Method Summary
 void addComponent(String componentName, Component component)
          Adds a component to the context.
 Endpoint addEndpoint(String uri, Endpoint endpoint)
          Adds the endpoint to the context using the given URI.
protected  Endpoint addEndpointToRegistry(String uri, Endpoint endpoint)
          Strategy to add the given endpoint to the internal endpoint registry
 void addInterceptStrategy(InterceptStrategy interceptStrategy)
          Adds the given interceptor strategy
 void addLifecycleStrategy(LifecycleStrategy lifecycleStrategy)
          Adds the given lifecycle strategy to be used.
 void addRegisterEndpointCallback(EndpointStrategy strategy)
          Registers a callback to allow you to do custom logic when an Endpoint is about to be registered to the CamelContext endpoint registry.
 void addRouteDefinition(RouteDefinition routeDefinition)
          Add a route definition to the context

Important: Each route in the same CamelContext must have an unique route id.

 void addRouteDefinitions(Collection<RouteDefinition> routeDefinitions)
          Adds a collection of route definitions to the context

Important: Each route in the same CamelContext must have an unique route id.

 void addRoutes(RoutesBuilder builder)
          Adds a collection of routes to this context using the given builder to build them.
 void addService(Object object)
          Adds a service to this context, which allows this context to control the lifecycle, ensuring the service is stopped when the context stops.
 void addStartupListener(StartupListener listener)
          Adds the given listener to be invoked when CamelContext have just been started.
protected  Endpoint convertBeanToEndpoint(String uri, Object bean)
          Strategy method for attempting to convert the bean from a Registry to an endpoint using some kind of transformation or wrapper
protected  ComponentResolver createComponentResolver()
          Lazily create a default implementation
 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.
protected  Endpoint createEndpoint(String uri)
          A pluggable strategy to allow an endpoint to be created without requiring a component to be its factory, such as for looking up the URI inside some Registry
protected  Injector createInjector()
          Lazily create a default implementation
protected  ManagementMBeanAssembler createManagementMBeanAssembler()
          Lazily create a default implementation
protected  ManagementStrategy createManagementStrategy()
           
 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.
protected  Registry createRegistry()
          Lazily create a default implementation
protected  TypeConverter createTypeConverter()
          Lazily create a default implementation
 void disableJMX()
          Disables using JMX as ManagementStrategy.
protected  void doResume()
          Implementations override this method to support customized suspend/resume.
protected  void doStart()
          Implementations override this method to support customized start/stop.
protected  void doStartOrResumeRoutes(Map<String,RouteService> routeServices, boolean checkClash, boolean startConsumer, boolean resumeConsumer, boolean addingRoutes)
          Starts or resumes the routes
protected  void doStop()
          Implementations override this method to support customized start/stop.
protected  void doSuspend()
          Implementations override this method to support customized suspend/resume.
protected  void forceLazyInitialization()
          Force some lazy initialization to occur upfront before we start any components and create routes
protected  void forceStopLazyInitialization()
          Force clear lazy initialization so they can be re-created on restart
 ClassLoader getApplicationContextClassLoader()
          Gets the the application context 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 name)
          Gets a component from the context by name.
<T extends Component>
T
getComponent(String name, Class<T> componentType)
          Gets a component from the context by name and specifying the expected type of component.
 List<String> getComponentNames()
          Gets a readonly list of names of the components currently registered
 ComponentResolver getComponentResolver()
           
 DataFormatResolver getDataFormatResolver()
          Gets the current data format resolver
 Map<String,DataFormatDefinition> getDataFormats()
          Gets the data formats that can be referenced in the routes.
 Debugger getDebugger()
          Gets the current Debugger
 FactoryFinder getDefaultFactoryFinder()
          Gets the default FactoryFinder which will be used for the loading the factory class from META-INF
 InterceptStrategy getDefaultTracer()
          Gets the default tracer
 Long getDelayer()
          Gets the delay value
 Endpoint getEndpoint(String uri)
          Resolves the given name to an Endpoint of the specified type.
<T extends Endpoint>
T
getEndpoint(String name, Class<T> endpointType)
          Resolves the given name to an Endpoint of the specified type.
protected  org.apache.camel.impl.EndpointKey getEndpointKey(String uri)
          Gets the endpoint key to use for lookup or whe adding endpoints to the EndpointRegistry
protected  org.apache.camel.impl.EndpointKey getEndpointKey(String uri, Endpoint endpoint)
          Gets the endpoint key to use for lookup or whe adding endpoints to the EndpointRegistry
 Map<String,Endpoint> getEndpointMap()
          Returns a new Map containing all of the active endpoints with the key of the map being their unique key.
 Collection<Endpoint> getEndpoints()
          Returns the collection of all registered endpoints.
 ErrorHandlerBuilder getErrorHandlerBuilder()
          Gets the default error handler builder which is inherited by the routes
 ScheduledExecutorService getErrorHandlerExecutorService()
          Gets the default shared thread pool for error handlers which leverages this for asynchronous redelivery tasks.
 ExecutorServiceManager getExecutorServiceManager()
          Gets the current ExecutorServiceManager
 ExecutorServiceStrategy getExecutorServiceStrategy()
          Deprecated. 
 FactoryFinder getFactoryFinder(String path)
          Gets the FactoryFinder which will be used for the loading the factory class from META-INF in the given path
 InflightRepository getInflightRepository()
          Gets the inflight repository
 Injector getInjector()
          Returns the injector used to instantiate objects by type
 List<InterceptStrategy> getInterceptStrategies()
          Gets the interceptor strategies
 List<String> getLanguageNames()
          Gets a readonly list with the names of the languages currently registered.
 LanguageResolver getLanguageResolver()
           
 List<LifecycleStrategy> getLifecycleStrategies()
          Returns the lifecycle strategies used to handle lifecycle notifications
 ManagementMBeanAssembler getManagementMBeanAssembler()
          Returns the management mbean assembler
 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 getName()
          Gets the name (id) of the this context.
 CamelContextNameStrategy getNameStrategy()
          Gets the current name strategy
 NodeIdFactory getNodeIdFactory()
          Gets the node id factory
 PackageScanClassResolver getPackageScanClassResolver()
          Returns the package scanning class resolver
 ProcessorFactory getProcessorFactory()
          Gets the current ProcessorFactory
 ServicePool<Endpoint,Producer> getProducerServicePool()
          Gets the service pool for Producer pooling.
 Map<String,String> getProperties()
          Gets the properties that can be referenced in the camel context
protected  PropertiesComponent getPropertiesComponent()
          Gets the properties component in use.
 String getPropertyPrefixToken()
          Returns the configured property placeholder prefix token if and only if the context has property placeholder abilities, otherwise returns null.
 String getPropertySuffixToken()
          Returns the configured property placeholder suffix token if and only if the context has property placeholder abilities, otherwise returns null.
 Registry getRegistry()
          Returns the registry used to lookup components by name and type such as the Spring ApplicationContext, JNDI or the OSGi Service Registry
 Route getRoute(String id)
          Gets the route with the given id
 RouteDefinition getRouteDefinition(String id)
          Gets the route definition with the given id
 List<RouteDefinition> getRouteDefinitions()
          Returns a list of the current route definitions
 List<Route> getRoutes()
          Returns the current routes in this context
protected  Map<String,RouteService> getRouteServices()
           
 List<RouteStartupOrder> getRouteStartupOrder()
          Returns the order in which the route inputs was started.
 ServiceStatus getRouteStatus(String key)
          Returns the current status of the given route
 ShutdownRoute getShutdownRoute()
          Gets the option to use when shutting down the route.
 ShutdownRunningTask getShutdownRunningTask()
          Gets the ShutdownRunningTask option in use when shutting down a route.
 ShutdownStrategy getShutdownStrategy()
          Gets the current shutdown strategy
 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
 UuidGenerator getUuidGenerator()
          Gets the current UuidGenerator
 Component hasComponent(String componentName)
          Is the given component already registered?
 Endpoint hasEndpoint(String uri)
          Is the given endpoint already registered?
 boolean hasService(Object object)
          Has the given service already been added to this context?
 boolean isAutoCreateComponents()
           
 Boolean isAutoStartup()
          Gets whether the object should automatically start when Camel starts.
 Boolean isHandleFault()
          Returns whether fault handling enabled
 Boolean isLazyLoadTypeConverters()
          Deprecated. 
 boolean isStartingRoutes()
          Indicates whether current thread is starting route(s).
 Boolean isStreamCaching()
          Returns whether stream cache is enabled
 Boolean isTracing()
          Returns whether tracing enabled
 Boolean isTypeConverterStatisticsEnabled()
          Whether or not type converter statistics is enabled.
 Boolean isUseBreadcrumb()
          Whether or not breadcrumb is enabled.
 Boolean isUseMDCLogging()
          Whether or not MDC logging is being enabled.
 RoutesDefinition loadRoutesDefinition(InputStream is)
          Loads a collection of route definitions from the given InputStream.
protected  void logRouteState(Route route, String state)
           
protected  Component lookupPropertiesComponent()
           
protected static String normalizeEndpointUri(String uri)
          Normalize uri so we can do endpoint hits with minor mistakes and parameters is not in the same order.
 Component removeComponent(String componentName)
          Removes a previously added component.
 Collection<Endpoint> removeEndpoints(String uri)
          Removes all endpoints with the given URI.
 boolean removeRoute(String routeId)
          Removes the given route (the route must be stopped before it can be removed).
 void removeRouteDefinition(RouteDefinition routeDefinition)
          Removes a route definition from the context - stopping any previously running routes if any of them are actively running
protected  boolean removeRouteDefinition(String key)
          Removes the route definition with the given key.
 void removeRouteDefinitions(Collection<RouteDefinition> routeDefinitions)
          Removes a collection of route definitions from the context - stopping any previously running routes if any of them are actively running
 boolean removeService(Object object)
          Removes a service from this context.
 DataFormat resolveDataFormat(String name)
          Resolve a data format given its name
 DataFormatDefinition resolveDataFormatDefinition(String name)
          Resolve a data format definition 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}}.
 void resumeRoute(String routeId)
          Resumes the given route if it has been previously suspended

If the route does not support suspension the route will be started instead

protected  void resumeRouteService(RouteService routeService)
          Resumes the given route service
protected  boolean routeSupportsSuspension(String routeId)
           
protected  void safelyStartRouteServices(boolean forceAutoStart, boolean checkClash, boolean startConsumer, boolean resumeConsumer, boolean addingRoutes, RouteService... routeServices)
           
protected  void safelyStartRouteServices(boolean checkClash, boolean startConsumer, boolean resumeConsumer, boolean addingRoutes, Collection<RouteService> routeServices)
          Starts the routes services in a proper manner which ensures the routes will be started in correct order, check for clash and that the routes will also be shutdown in correct order as well.
 void setApplicationContextClassLoader(ClassLoader classLoader)
          Sets the application context class loader
 void setAutoCreateComponents(boolean autoCreateComponents)
           
 void setAutoStartup(Boolean autoStartup)
          Sets whether the object should automatically start when Camel starts.
 void setClassResolver(ClassResolver classResolver)
          Sets the class resolver to be use
 void setComponentResolver(ComponentResolver componentResolver)
           
static void setContextCounter(int value)
          Reset context counter to a preset value.
 void setDataFormatResolver(DataFormatResolver dataFormatResolver)
          Sets a custom data format resolver
 void setDataFormats(Map<String,DataFormatDefinition> dataFormats)
          Sets the data formats that can be referenced in the routes.
 void setDebugger(Debugger debugger)
          Sets a custom Debugger
 void setDefaultTracer(InterceptStrategy defaultTracer)
          Sets a custom tracer to be used as the default tracer.
 void setDelayer(Long delay)
          Sets a delay value in millis that a message is delayed at every step it takes in the route path, slowing the process down to better observe what is occurring

Is disabled by default

 void setErrorHandlerBuilder(ErrorHandlerFactory errorHandlerBuilder)
          Sets the default error handler builder which is inherited by the routes
 void setExecutorServiceManager(ExecutorServiceManager executorServiceManager)
          Sets a custom ExecutorServiceManager
 void setFactoryFinderResolver(FactoryFinderResolver resolver)
          Sets the factory finder resolver to use.
 void setHandleFault(Boolean handleFault)
          Sets whether fault handling is enabled or not (default is disabled).
 void setInflightRepository(InflightRepository repository)
          Sets a custom inflight repository to use
 void setInjector(Injector injector)
           
 void setInterceptStrategies(List<InterceptStrategy> interceptStrategies)
           
 void setJndiContext(Context jndiContext)
          Sets the registry to the given JNDI context
 void setLanguageResolver(LanguageResolver languageResolver)
           
 void setLazyLoadTypeConverters(Boolean lazyLoadTypeConverters)
          Deprecated. 
 void setLifecycleStrategies(List<LifecycleStrategy> lifecycleStrategies)
           
 void setManagementMBeanAssembler(ManagementMBeanAssembler managementMBeanAssembler)
           
 void setManagementName(String managementName)
           
 void setManagementNameStrategy(ManagementNameStrategy managementNameStrategy)
          Sets a custom management name strategy
 void setManagementStrategy(ManagementStrategy managementStrategy)
          Sets the management strategy to use
 void setName(String name)
          Sets the name of the this context.
 void setNameStrategy(CamelContextNameStrategy nameStrategy)
          Sets a custom name strategy
 void setNodeIdFactory(NodeIdFactory idFactory)
          Uses a custom node id factory when generating auto assigned ids to the nodes in the route definitions
 void setPackageScanClassResolver(PackageScanClassResolver packageScanClassResolver)
          Sets the package scanning class resolver to use
 void setProcessorFactory(ProcessorFactory processorFactory)
          Sets a custom ProcessorFactory
 void setProducerServicePool(ServicePool<Endpoint,Producer> producerServicePool)
          Sets a pluggable service pool to use for Producer pooling.
 void setProperties(Map<String,String> properties)
          Sets the properties that can be referenced in the camel context
 void setRegistry(Registry registry)
           
 void setRoutes(List<Route> routes)
          Deprecated. 
 void setShutdownRoute(ShutdownRoute shutdownRoute)
          Sets the ShutdownRoute option for routes.
 void setShutdownRunningTask(ShutdownRunningTask shutdownRunningTask)
          Sets the ShutdownRunningTask option to use when shutting down a route.
 void setShutdownStrategy(ShutdownStrategy shutdownStrategy)
          Sets a custom shutdown strategy
 void setStreamCaching(Boolean cache)
          Sets whether stream caching is enabled or not (default is disabled).
 void setTracing(Boolean tracing)
          Sets whether tracing is enabled or not (default is disabled).
 void setTypeConverter(TypeConverter typeConverter)
           
 void setTypeConverterRegistry(TypeConverterRegistry typeConverterRegistry)
           
 void setTypeConverterStatisticsEnabled(Boolean typeConverterStatisticsEnabled)
          Sets whether or not type converter statistics is enabled.
 void setUseBreadcrumb(Boolean useBreadcrumb)
          Set whether breadcrumb is enabled.
 void setUseMDCLogging(Boolean useMDCLogging)
          Set whether MDC is enabled.
 void setUuidGenerator(UuidGenerator uuidGenerator)
          Sets a custom UuidGenerator (should only be set once)
protected  boolean shouldStartRoutes()
          Should we start newly added routes?
 void shutdownRoute(String routeId)
          Shutdown and removes the given route using ShutdownStrategy.
 void shutdownRoute(String routeId, long timeout, TimeUnit timeUnit)
          Shutdown and removes the given route using ShutdownStrategy with a specified timeout.
protected  void shutdownRouteService(RouteService routeService)
           
 void start()
          Starts the service
 void startRoute(RouteDefinition route)
          Starts the given route if it has been previously stopped
 void startRoute(String routeId)
          Starts the given route if it has been previously stopped
protected  void startRouteDefinitions(Collection<RouteDefinition> list)
           
protected  void startRouteService(RouteService routeService, boolean addingRoutes)
          Starts the given route service
 void stopRoute(RouteDefinition route)
          Stops the given route.
 void stopRoute(String routeId)
          Stops the given route using ShutdownStrategy.
 void stopRoute(String routeId, long timeout, TimeUnit timeUnit)
          Stops the given route using ShutdownStrategy with a specified timeout.
 boolean stopRoute(String routeId, long timeout, TimeUnit timeUnit, boolean abortAfterTimeout)
          Stops the given route using ShutdownStrategy with a specified timeout and optional abortAfterTimeout mode.
protected  void stopRouteService(RouteService routeService)
           
protected  void stopRouteService(RouteService routeService, boolean removingRoutes)
           
 void suspendRoute(String routeId)
          Suspends the given route using ShutdownStrategy.
 void suspendRoute(String routeId, long timeout, TimeUnit timeUnit)
          Suspends the given route using ShutdownStrategy with a specified timeout.
protected  void suspendRouteService(RouteService routeService)
           
 String toString()
           
 
Methods inherited from class org.apache.camel.support.ServiceSupport
doShutdown, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspended, isSuspending, resume, shutdown, stop, suspend
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.camel.CamelContext
getStatus, getVersion
 
Methods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
 
Methods inherited from interface org.apache.camel.Service
stop
 

Constructor Detail

DefaultCamelContext

public DefaultCamelContext()

DefaultCamelContext

public DefaultCamelContext(Context jndiContext)
Creates the CamelContext using the given JNDI context as the registry

Parameters:
jndiContext - the JNDI context

DefaultCamelContext

public DefaultCamelContext(Registry registry)
Creates the CamelContext using the given registry

Parameters:
registry - the registry
Method Detail

getName

public String getName()
Description copied from interface: CamelContext
Gets the name (id) of the this context.

Specified by:
getName in interface CamelContext
Returns:
the name

setName

public void setName(String name)
Sets the name of the this context.

Parameters:
name - the name

getNameStrategy

public CamelContextNameStrategy getNameStrategy()
Description copied from interface: CamelContext
Gets the current name strategy

Specified by:
getNameStrategy in interface CamelContext
Returns:
name strategy

setNameStrategy

public void setNameStrategy(CamelContextNameStrategy nameStrategy)
Description copied from interface: CamelContext
Sets a custom name strategy

Specified by:
setNameStrategy in interface CamelContext
Parameters:
nameStrategy - name strategy

getManagementNameStrategy

public ManagementNameStrategy getManagementNameStrategy()
Description copied from interface: CamelContext
Gets the current management name strategy

Specified by:
getManagementNameStrategy in interface CamelContext
Returns:
management name strategy

setManagementNameStrategy

public void setManagementNameStrategy(ManagementNameStrategy managementNameStrategy)
Description copied from interface: CamelContext
Sets a custom management name strategy

Specified by:
setManagementNameStrategy in interface CamelContext
Parameters:
managementNameStrategy - name strategy

getManagementName

public String getManagementName()
Description copied from interface: CamelContext
Gets the name this 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 CamelContexts in the same JVM. Camel will automatic reassign and use a free name to avoid failing to start.

Specified by:
getManagementName in interface CamelContext
Returns:
the management name

setManagementName

public void setManagementName(String managementName)

hasComponent

public Component hasComponent(String componentName)
Description copied from interface: CamelContext
Is the given component already registered?

Specified by:
hasComponent in interface CamelContext
Parameters:
componentName - the name of the component
Returns:
the registered Component or null if not registered

addComponent

public void addComponent(String componentName,
                         Component component)
Description copied from interface: CamelContext
Adds a component to the context.

Specified by:
addComponent in interface CamelContext
Parameters:
componentName - the name the component is registered as
component - the component

getComponent

public Component getComponent(String name)
Description copied from interface: CamelContext
Gets a component from the context by name.

Specified by:
getComponent in interface CamelContext
Parameters:
name - the name of the component
Returns:
the component

getComponent

public <T extends Component> T getComponent(String name,
                                            Class<T> componentType)
Description copied from interface: CamelContext
Gets a component from the context by name and specifying the expected type of component.

Specified by:
getComponent in interface CamelContext
Parameters:
name - the name to lookup
componentType - the expected type
Returns:
the component

removeComponent

public Component removeComponent(String componentName)
Description copied from interface: CamelContext
Removes a previously added component.

Specified by:
removeComponent in interface CamelContext
Parameters:
componentName - the component name to remove
Returns:
the previously added component or null if it had not been previously added.

getEndpoints

public Collection<Endpoint> getEndpoints()
Description copied from interface: CamelContext
Returns the collection of all registered endpoints.

Specified by:
getEndpoints in interface CamelContext
Returns:
all endpoints

getEndpointMap

public Map<String,Endpoint> getEndpointMap()
Description copied from interface: CamelContext
Returns a new Map containing all of the active endpoints with the key of the map being their unique key.

Specified by:
getEndpointMap in interface CamelContext
Returns:
map of active endpoints

hasEndpoint

public Endpoint hasEndpoint(String uri)
Description copied from interface: CamelContext
Is the given endpoint already registered?

Specified by:
hasEndpoint in interface CamelContext
Parameters:
uri - the URI of the endpoint
Returns:
the registered endpoint or null if not registered

addEndpoint

public Endpoint addEndpoint(String uri,
                            Endpoint endpoint)
                     throws Exception
Description copied from interface: CamelContext
Adds the endpoint to the context using the given URI.

Specified by:
addEndpoint in interface CamelContext
Parameters:
uri - the URI to be used to resolve this endpoint
endpoint - the endpoint to be added to the context
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

removeEndpoints

public Collection<Endpoint> removeEndpoints(String uri)
                                     throws Exception
Description copied from interface: CamelContext
Removes all endpoints with the given URI.

Specified by:
removeEndpoints in interface CamelContext
Parameters:
uri - 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

getEndpoint

public Endpoint getEndpoint(String uri)
Description copied from interface: CamelContext
Resolves the given name to an 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.

Specified by:
getEndpoint in interface CamelContext
Parameters:
uri - the URI of the endpoint
Returns:
the endpoint

getEndpoint

public <T extends Endpoint> T getEndpoint(String name,
                                          Class<T> endpointType)
Description copied from interface: CamelContext
Resolves the given name to an 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.

Specified by:
getEndpoint in interface CamelContext
Parameters:
name - the name of the endpoint
endpointType - the expected type
Returns:
the endpoint

addRegisterEndpointCallback

public void addRegisterEndpointCallback(EndpointStrategy strategy)
Description copied from interface: CamelContext
Registers a callback to allow you to do custom logic when an Endpoint is about to be registered to the CamelContext endpoint registry.

When a callback is added it will be executed on the already registered endpoints allowing you to catch-up

Specified by:
addRegisterEndpointCallback in interface CamelContext
Parameters:
strategy - callback to be invoked

addEndpointToRegistry

protected Endpoint addEndpointToRegistry(String uri,
                                         Endpoint endpoint)
Strategy to add the given endpoint to the internal endpoint registry

Parameters:
uri - uri of the endpoint
endpoint - the endpoint to add
Returns:
the added endpoint

normalizeEndpointUri

protected static String normalizeEndpointUri(String uri)
Normalize uri so we can do endpoint hits with minor mistakes and parameters is not in the same order.

Parameters:
uri - the uri
Returns:
normalized uri
Throws:
ResolveEndpointFailedException - if uri cannot be normalized

getEndpointKey

protected org.apache.camel.impl.EndpointKey getEndpointKey(String uri)
Gets the endpoint key to use for lookup or whe adding endpoints to the EndpointRegistry

Parameters:
uri - the endpoint uri
Returns:
the key

getEndpointKey

protected org.apache.camel.impl.EndpointKey getEndpointKey(String uri,
                                                           Endpoint endpoint)
Gets the endpoint key to use for lookup or whe adding endpoints to the EndpointRegistry

Parameters:
uri - the endpoint uri
endpoint - the endpoint
Returns:
the key

getRouteStartupOrder

public 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

getRoutes

public List<Route> getRoutes()
Description copied from interface: CamelContext
Returns the current routes in this context

Specified by:
getRoutes in interface CamelContext
Returns:
the current routes

getRoute

public Route getRoute(String id)
Description copied from interface: CamelContext
Gets the route with the given id

Specified by:
getRoute in interface CamelContext
Parameters:
id - id of the route
Returns:
the route or null if not found

setRoutes

@Deprecated
public void setRoutes(List<Route> routes)
Deprecated. 


addRoutes

public void addRoutes(RoutesBuilder builder)
               throws Exception
Description copied from interface: CamelContext
Adds a collection of routes to this context using the given builder to build them.

Important: The added routes will only be started, if CamelContext is already started. You may want to check the state of CamelContext before adding the routes, using the CamelContext.getStatus() method.

Important: Each route in the same CamelContext must have an unique route id. If you use the API from CamelContext or 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.

Specified by:
addRoutes in interface CamelContext
Parameters:
builder - the builder which will create the routes and add them to this context
Throws:
Exception - if the routes could not be created for whatever reason

loadRoutesDefinition

public RoutesDefinition loadRoutesDefinition(InputStream is)
                                      throws Exception
Description copied from interface: ModelCamelContext
Loads a collection of route definitions from the given InputStream.

Specified by:
loadRoutesDefinition in interface CamelContext
Specified by:
loadRoutesDefinition in interface ModelCamelContext
Parameters:
is - input stream with the route(s) definition to add
Returns:
the route definitions
Throws:
Exception - if the route definitions could not be loaded for whatever reason

addRouteDefinitions

public void addRouteDefinitions(Collection<RouteDefinition> routeDefinitions)
                         throws Exception
Description copied from interface: ModelCamelContext
Adds a collection of route definitions to the context

Important: Each route in the same CamelContext must have an unique route id. If you use the API from CamelContext or 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.

Specified by:
addRouteDefinitions in interface CamelContext
Specified by:
addRouteDefinitions in interface ModelCamelContext
Parameters:
routeDefinitions - the route(s) definition to add
Throws:
Exception - if the route definitions could not be created for whatever reason

addRouteDefinition

public void addRouteDefinition(RouteDefinition routeDefinition)
                        throws Exception
Description copied from interface: ModelCamelContext
Add a route definition to the context

Important: Each route in the same CamelContext must have an unique route id. If you use the API from CamelContext or 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.

Specified by:
addRouteDefinition in interface CamelContext
Specified by:
addRouteDefinition in interface ModelCamelContext
Parameters:
routeDefinition - the route definition to add
Throws:
Exception - if the route definition could not be created for whatever reason

removeRouteDefinition

protected boolean removeRouteDefinition(String key)
Removes the route definition with the given key.

Returns:
true if one or more routes was removed

removeRouteDefinitions

public void removeRouteDefinitions(Collection<RouteDefinition> routeDefinitions)
                            throws Exception
Description copied from interface: ModelCamelContext
Removes a collection of route definitions from the context - stopping any previously running routes if any of them are actively running

Specified by:
removeRouteDefinitions in interface CamelContext
Specified by:
removeRouteDefinitions in interface ModelCamelContext
Parameters:
routeDefinitions - route(s) definitions to remove
Throws:
Exception - if the route definitions could not be removed for whatever reason

removeRouteDefinition

public void removeRouteDefinition(RouteDefinition routeDefinition)
                           throws Exception
Description copied from interface: ModelCamelContext
Removes a route definition from the context - stopping any previously running routes if any of them are actively running

Specified by:
removeRouteDefinition in interface CamelContext
Specified by:
removeRouteDefinition in interface ModelCamelContext
Parameters:
routeDefinition - route definition to remove
Throws:
Exception - if the route definition could not be removed for whatever reason

getRouteStatus

public ServiceStatus getRouteStatus(String key)
Description copied from interface: CamelContext
Returns the current status of the given route

Specified by:
getRouteStatus in interface CamelContext
Parameters:
key - the route id
Returns:
the status for the route

startRoute

public void startRoute(RouteDefinition route)
                throws Exception
Description copied from interface: ModelCamelContext
Starts the given route if it has been previously stopped

Specified by:
startRoute in interface CamelContext
Specified by:
startRoute in interface ModelCamelContext
Parameters:
route - the route to start
Throws:
Exception - is thrown if the route could not be started for whatever reason

isStartingRoutes

public boolean isStartingRoutes()
Description copied from interface: CamelContext
Indicates whether current thread is starting route(s).

This can be useful to know by LifecycleStrategy or the likes, in case they need to react differently.

Specified by:
isStartingRoutes in interface CamelContext
Returns:
true if current thread is starting route(s), or false if not.

stopRoute

public void stopRoute(RouteDefinition route)
               throws Exception
Description copied from interface: ModelCamelContext
Stops the given route.

Specified by:
stopRoute in interface CamelContext
Specified by:
stopRoute in interface ModelCamelContext
Parameters:
route - the route to stop
Throws:
Exception - is thrown if the route could not be stopped for whatever reason

startRoute

public void startRoute(String routeId)
                throws Exception
Description copied from interface: CamelContext
Starts the given route if it has been previously stopped

Specified by:
startRoute in interface CamelContext
Parameters:
routeId - the route id
Throws:
Exception - is thrown if the route could not be started for whatever reason

resumeRoute

public void resumeRoute(String routeId)
                 throws Exception
Description copied from interface: CamelContext
Resumes the given route if it has been previously suspended

If the route does not support suspension the route will be started instead

Specified by:
resumeRoute in interface CamelContext
Parameters:
routeId - the route id
Throws:
Exception - is thrown if the route could not be resumed for whatever reason

stopRoute

public boolean stopRoute(String routeId,
                         long timeout,
                         TimeUnit timeUnit,
                         boolean abortAfterTimeout)
                  throws Exception
Description copied from interface: CamelContext
Stops the given route using ShutdownStrategy with a specified timeout and optional abortAfterTimeout mode.

Specified by:
stopRoute in interface CamelContext
Parameters:
routeId - the route id
timeout - timeout
timeUnit - the unit to use
abortAfterTimeout - should abort shutdown after timeout
Returns:
true if the route is stopped before the timeout
Throws:
Exception - is thrown if the route could not be stopped for whatever reason
See Also:
CamelContext.suspendRoute(String, long, java.util.concurrent.TimeUnit)

stopRoute

public void stopRoute(String routeId)
               throws Exception
Description copied from interface: CamelContext
Stops the given route using ShutdownStrategy.

Specified by:
stopRoute in interface CamelContext
Parameters:
routeId - the route id
Throws:
Exception - is thrown if the route could not be stopped for whatever reason
See Also:
CamelContext.suspendRoute(String)

stopRoute

public void stopRoute(String routeId,
                      long timeout,
                      TimeUnit timeUnit)
               throws Exception
Description copied from interface: CamelContext
Stops the given route using ShutdownStrategy with a specified timeout.

Specified by:
stopRoute in interface CamelContext
Parameters:
routeId - the route id
timeout - timeout
timeUnit - the unit to use
Throws:
Exception - is thrown if the route could not be stopped for whatever reason
See Also:
CamelContext.suspendRoute(String, long, java.util.concurrent.TimeUnit)

shutdownRoute

public void shutdownRoute(String routeId)
                   throws Exception
Description copied from interface: CamelContext
Shutdown and removes the given route using ShutdownStrategy.

Specified by:
shutdownRoute in interface CamelContext
Parameters:
routeId - the route id
Throws:
Exception - is thrown if the route could not be shutdown for whatever reason

shutdownRoute

public void shutdownRoute(String routeId,
                          long timeout,
                          TimeUnit timeUnit)
                   throws Exception
Description copied from interface: CamelContext
Shutdown and removes the given route using ShutdownStrategy with a specified timeout.

Specified by:
shutdownRoute in interface CamelContext
Parameters:
routeId - the route id
timeout - timeout
timeUnit - the unit to use
Throws:
Exception - is thrown if the route could not be shutdown for whatever reason

removeRoute

public boolean removeRoute(String routeId)
                    throws Exception
Description copied from interface: CamelContext
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.


End users can use this method to remove unwanted routes or temporary routes which no longer is in demand.

Specified by:
removeRoute in interface CamelContext
Parameters:
routeId - the route id
Returns:
true if the route was removed, false if the route could not be removed because its not stopped
Throws:
Exception - is thrown if the route could not be shutdown for whatever reason

suspendRoute

public void suspendRoute(String routeId)
                  throws Exception
Description copied from interface: CamelContext
Suspends the given route using ShutdownStrategy.

Suspending a route is more gently than stopping, as the route consumers will be suspended (if they support) otherwise the consumers will be stopped.

By suspending the route services will be kept running (if possible) and therefore its faster to resume the route.

If the route does not support suspension the route will be stopped instead

Specified by:
suspendRoute in interface CamelContext
Parameters:
routeId - the route id
Throws:
Exception - is thrown if the route could not be suspended for whatever reason

suspendRoute

public void suspendRoute(String routeId,
                         long timeout,
                         TimeUnit timeUnit)
                  throws Exception
Description copied from interface: CamelContext
Suspends the given route using ShutdownStrategy with a specified timeout.

Suspending a route is more gently than stopping, as the route consumers will be suspended (if they support) otherwise the consumers will be stopped.

By suspending the route services will be kept running (if possible) and therefore its faster to resume the route.

If the route does not support suspension the route will be stopped instead

Specified by:
suspendRoute in interface CamelContext
Parameters:
routeId - the route id
timeout - timeout
timeUnit - the unit to use
Throws:
Exception - is thrown if the route could not be suspended for whatever reason

addService

public void addService(Object object)
                throws Exception
Description copied from interface: CamelContext
Adds a service to this context, which allows this context to control the lifecycle, ensuring the service is stopped when the context stops.

The service will also have 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.

Specified by:
addService in interface CamelContext
Parameters:
object - the service
Throws:
Exception - can be thrown when starting the service

removeService

public boolean removeService(Object object)
                      throws Exception
Description copied from interface: CamelContext
Removes a service from this context.

The service is assumed to have been previously added using CamelContext.addService(Object) method. This method will not change the service lifecycle.

Specified by:
removeService in interface CamelContext
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

public boolean hasService(Object object)
Description copied from interface: CamelContext
Has the given service already been added to this context?

Specified by:
hasService in interface CamelContext
Parameters:
object - the service
Returns:
true if already added, false if not.

addStartupListener

public void addStartupListener(StartupListener listener)
                        throws Exception
Description copied from interface: CamelContext
Adds the given listener to be invoked when 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.

Specified by:
addStartupListener in interface CamelContext
Parameters:
listener - the listener
Throws:
Exception - can be thrown if CamelContext is already started and the listener is invoked and cause an exception to be thrown

resolveLanguage

public Language resolveLanguage(String language)
Description copied from interface: CamelContext
Resolves a language for creating expressions

Specified by:
resolveLanguage in interface CamelContext
Parameters:
language - name of the language
Returns:
the resolved language

getPropertyPrefixToken

public String getPropertyPrefixToken()
Description copied from interface: CamelContext
Returns the configured property placeholder prefix token if and only if the context has property placeholder abilities, otherwise returns null.

Specified by:
getPropertyPrefixToken in interface CamelContext
Returns:
the prefix token or null

getPropertySuffixToken

public String getPropertySuffixToken()
Description copied from interface: CamelContext
Returns the configured property placeholder suffix token if and only if the context has property placeholder abilities, otherwise returns null.

Specified by:
getPropertySuffixToken in interface CamelContext
Returns:
the suffix token or null

resolvePropertyPlaceholders

public String resolvePropertyPlaceholders(String text)
                                   throws Exception
Description copied from interface: CamelContext
Parses the given text and resolve any property placeholders - using {{key}}.

Specified by:
resolvePropertyPlaceholders in interface CamelContext
Parameters:
text - the text such as an endpoint uri or the likes
Returns:
the text with resolved property placeholders
Throws:
Exception - is thrown if property placeholders was used and there was an error resolving them

getTypeConverter

public TypeConverter getTypeConverter()
Description copied from interface: CamelContext
Returns the type converter used to coerce types from one type to another

Specified by:
getTypeConverter in interface CamelContext
Returns:
the converter

setTypeConverter

public void setTypeConverter(TypeConverter typeConverter)

getTypeConverterRegistry

public TypeConverterRegistry getTypeConverterRegistry()
Description copied from interface: CamelContext
Returns the type converter registry where type converters can be added or looked up

Specified by:
getTypeConverterRegistry in interface CamelContext
Returns:
the type converter registry

setTypeConverterRegistry

public void setTypeConverterRegistry(TypeConverterRegistry typeConverterRegistry)

getInjector

public Injector getInjector()
Description copied from interface: CamelContext
Returns the injector used to instantiate objects by type

Specified by:
getInjector in interface CamelContext
Returns:
the injector

setInjector

public void setInjector(Injector injector)

getManagementMBeanAssembler

public ManagementMBeanAssembler getManagementMBeanAssembler()
Description copied from interface: CamelContext
Returns the management mbean assembler

Specified by:
getManagementMBeanAssembler in interface CamelContext
Returns:
the mbean assembler

setManagementMBeanAssembler

public void setManagementMBeanAssembler(ManagementMBeanAssembler managementMBeanAssembler)

getComponentResolver

public ComponentResolver getComponentResolver()

setComponentResolver

public void setComponentResolver(ComponentResolver componentResolver)

getLanguageResolver

public LanguageResolver getLanguageResolver()

setLanguageResolver

public void setLanguageResolver(LanguageResolver languageResolver)

isAutoCreateComponents

public boolean isAutoCreateComponents()

setAutoCreateComponents

public void setAutoCreateComponents(boolean autoCreateComponents)

getRegistry

public Registry getRegistry()
Description copied from interface: CamelContext
Returns the registry used to lookup components by name and type such as the Spring ApplicationContext, JNDI or the OSGi Service Registry

Specified by:
getRegistry in interface CamelContext
Returns:
the registry

setJndiContext

public void setJndiContext(Context jndiContext)
Sets the registry to the given JNDI context

Parameters:
jndiContext - is the JNDI context to use as the registry
See Also:
setRegistry(org.apache.camel.spi.Registry)

setRegistry

public void setRegistry(Registry registry)

getLifecycleStrategies

public List<LifecycleStrategy> getLifecycleStrategies()
Description copied from interface: CamelContext
Returns the lifecycle strategies used to handle lifecycle notifications

Specified by:
getLifecycleStrategies in interface CamelContext
Returns:
the lifecycle strategies

setLifecycleStrategies

public void setLifecycleStrategies(List<LifecycleStrategy> lifecycleStrategies)

addLifecycleStrategy

public void addLifecycleStrategy(LifecycleStrategy lifecycleStrategy)
Description copied from interface: CamelContext
Adds the given lifecycle strategy to be used.

Specified by:
addLifecycleStrategy in interface CamelContext
Parameters:
lifecycleStrategy - the strategy

getRouteDefinitions

public List<RouteDefinition> getRouteDefinitions()
Description copied from interface: ModelCamelContext
Returns a list of the current route definitions

Specified by:
getRouteDefinitions in interface CamelContext
Specified by:
getRouteDefinitions in interface ModelCamelContext
Returns:
list of the current route definitions

getRouteDefinition

public RouteDefinition getRouteDefinition(String id)
Description copied from interface: ModelCamelContext
Gets the route definition with the given id

Specified by:
getRouteDefinition in interface CamelContext
Specified by:
getRouteDefinition in interface ModelCamelContext
Parameters:
id - id of the route
Returns:
the route definition or null if not found

getInterceptStrategies

public List<InterceptStrategy> getInterceptStrategies()
Description copied from interface: CamelContext
Gets the interceptor strategies

Specified by:
getInterceptStrategies in interface CamelContext
Returns:
the list of current interceptor strategies

setInterceptStrategies

public void setInterceptStrategies(List<InterceptStrategy> interceptStrategies)

addInterceptStrategy

public void addInterceptStrategy(InterceptStrategy interceptStrategy)
Description copied from interface: CamelContext
Adds the given interceptor strategy

Specified by:
addInterceptStrategy in interface CamelContext
Parameters:
interceptStrategy - the strategy

setStreamCaching

public void setStreamCaching(Boolean cache)
Description copied from interface: RuntimeConfiguration
Sets whether stream caching is enabled or not (default is disabled).

Specified by:
setStreamCaching in interface RuntimeConfiguration
Parameters:
cache - whether stream caching is enabled or not

isStreamCaching

public Boolean isStreamCaching()
Description copied from interface: RuntimeConfiguration
Returns whether stream cache is enabled

Specified by:
isStreamCaching in interface RuntimeConfiguration
Returns:
true if stream cache is enabled

setTracing

public void setTracing(Boolean tracing)
Description copied from interface: RuntimeConfiguration
Sets whether tracing is enabled or not (default is disabled).

Specified by:
setTracing in interface RuntimeConfiguration
Parameters:
tracing - whether to enable tracing.

isTracing

public Boolean isTracing()
Description copied from interface: RuntimeConfiguration
Returns whether tracing enabled

Specified by:
isTracing in interface RuntimeConfiguration
Returns:
true if tracing is enabled

isHandleFault

public Boolean isHandleFault()
Description copied from interface: RuntimeConfiguration
Returns whether fault handling enabled

Specified by:
isHandleFault in interface RuntimeConfiguration
Returns:
true if fault handling is enabled

setHandleFault

public void setHandleFault(Boolean handleFault)
Description copied from interface: RuntimeConfiguration
Sets whether fault handling is enabled or not (default is disabled).

Specified by:
setHandleFault in interface RuntimeConfiguration
Parameters:
handleFault - whether to enable fault handling.

getDelayer

public Long getDelayer()
Description copied from interface: RuntimeConfiguration
Gets the delay value

Specified by:
getDelayer in interface RuntimeConfiguration
Returns:
delay in millis, or null if disabled

setDelayer

public void setDelayer(Long delay)
Description copied from interface: RuntimeConfiguration
Sets a delay value in millis that a message is delayed at every step it takes in the route path, slowing the process down to better observe what is occurring

Is disabled by default

Specified by:
setDelayer in interface RuntimeConfiguration
Parameters:
delay - delay in millis

createProducerTemplate

public ProducerTemplate createProducerTemplate()
Description copied from interface: CamelContext
Creates a new 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.

Specified by:
createProducerTemplate in interface CamelContext
Returns:
the template

createProducerTemplate

public ProducerTemplate createProducerTemplate(int maximumCacheSize)
Description copied from interface: CamelContext
Creates a new 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.

Specified by:
createProducerTemplate in interface CamelContext
Parameters:
maximumCacheSize - the maximum cache size
Returns:
the template

createConsumerTemplate

public ConsumerTemplate createConsumerTemplate()
Description copied from interface: CamelContext
Creates a new 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.

Specified by:
createConsumerTemplate in interface CamelContext
Returns:
the template

createConsumerTemplate

public ConsumerTemplate createConsumerTemplate(int maximumCacheSize)
Description copied from interface: CamelContext
Creates a new 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.

Specified by:
createConsumerTemplate in interface CamelContext
Parameters:
maximumCacheSize - the maximum cache size
Returns:
the template

getErrorHandlerBuilder

public ErrorHandlerBuilder getErrorHandlerBuilder()
Description copied from interface: CamelContext
Gets the default error handler builder which is inherited by the routes

Specified by:
getErrorHandlerBuilder in interface CamelContext
Returns:
the builder

setErrorHandlerBuilder

public void setErrorHandlerBuilder(ErrorHandlerFactory errorHandlerBuilder)
Description copied from interface: CamelContext
Sets the default error handler builder which is inherited by the routes

Specified by:
setErrorHandlerBuilder in interface CamelContext
Parameters:
errorHandlerBuilder - the builder

getErrorHandlerExecutorService

public ScheduledExecutorService getErrorHandlerExecutorService()
Description copied from interface: CamelContext
Gets the default shared thread pool for error handlers which leverages this for asynchronous redelivery tasks.

Specified by:
getErrorHandlerExecutorService in interface CamelContext

setProducerServicePool

public void setProducerServicePool(ServicePool<Endpoint,Producer> producerServicePool)
Description copied from interface: CamelContext
Sets a pluggable service pool to use for Producer pooling.

Specified by:
setProducerServicePool in interface CamelContext
Parameters:
producerServicePool - the pool

getProducerServicePool

public ServicePool<Endpoint,Producer> getProducerServicePool()
Description copied from interface: CamelContext
Gets the service pool for Producer pooling.

Specified by:
getProducerServicePool in interface CamelContext
Returns:
the service pool

getUptime

public String getUptime()
Description copied from interface: CamelContext
Gets the uptime in a human readable format

Specified by:
getUptime in interface CamelContext
Returns:
the uptime in days/hours/minutes

doSuspend

protected void doSuspend()
                  throws Exception
Description copied from class: ServiceSupport
Implementations override this method to support customized suspend/resume.

Overrides:
doSuspend in class ServiceSupport
Throws:
Exception

doResume

protected void doResume()
                 throws Exception
Description copied from class: ServiceSupport
Implementations override this method to support customized suspend/resume.

Overrides:
doResume in class ServiceSupport
Throws:
Exception

start

public void start()
           throws Exception
Description copied from interface: Service
Starts the service

Specified by:
start in interface Service
Overrides:
start in class ServiceSupport
Throws:
Exception - is thrown if starting failed

doStart

protected void doStart()
                throws Exception
Description copied from class: ServiceSupport
Implementations override this method to support customized start/stop.

Important: See ServiceSupport.doStop() for more details.

Specified by:
doStart in class ServiceSupport
Throws:
Exception
See Also:
ServiceSupport.doStop()

doStop

protected void doStop()
               throws Exception
Description copied from class: ServiceSupport
Implementations override this method to support customized start/stop.

Important: Camel will invoke this ServiceSupport.doStop() method when the service is being stopped. This method will also be invoked if the service is still in uninitialized state (eg has not been started). The method is always called to allow the service to do custom logic when the service is being stopped, such as when CamelContext is shutting down.

Specified by:
doStop in class ServiceSupport
Throws:
Exception
See Also:
ServiceSupport.doStart()

doStartOrResumeRoutes

protected void doStartOrResumeRoutes(Map<String,RouteService> routeServices,
                                     boolean checkClash,
                                     boolean startConsumer,
                                     boolean resumeConsumer,
                                     boolean addingRoutes)
                              throws Exception
Starts or resumes the routes

Parameters:
routeServices - the routes to start (will only start a route if its not already started)
checkClash - whether to check for startup ordering clash
startConsumer - whether the route consumer should be started. Can be used to warmup the route without starting the consumer.
resumeConsumer - whether the route consumer should be resumed.
addingRoutes - whether we are adding new routes
Throws:
Exception - is thrown if error starting routes

routeSupportsSuspension

protected boolean routeSupportsSuspension(String routeId)

startRouteDefinitions

protected void startRouteDefinitions(Collection<RouteDefinition> list)
                              throws Exception
Throws:
Exception

startRouteService

protected void startRouteService(RouteService routeService,
                                 boolean addingRoutes)
                          throws Exception
Starts the given route service

Throws:
Exception

resumeRouteService

protected void resumeRouteService(RouteService routeService)
                           throws Exception
Resumes the given route service

Throws:
Exception

stopRouteService

protected void stopRouteService(RouteService routeService,
                                boolean removingRoutes)
                         throws Exception
Throws:
Exception

logRouteState

protected void logRouteState(Route route,
                             String state)

stopRouteService

protected void stopRouteService(RouteService routeService)
                         throws Exception
Throws:
Exception

shutdownRouteService

protected void shutdownRouteService(RouteService routeService)
                             throws Exception
Throws:
Exception

suspendRouteService

protected void suspendRouteService(RouteService routeService)
                            throws Exception
Throws:
Exception

safelyStartRouteServices

protected void safelyStartRouteServices(boolean checkClash,
                                        boolean startConsumer,
                                        boolean resumeConsumer,
                                        boolean addingRoutes,
                                        Collection<RouteService> routeServices)
                                 throws Exception
Starts the routes services in a proper manner which ensures the routes will be started in correct order, check for clash and that the routes will also be shutdown in correct order as well.

This method must be used to start routes in a safe manner.

Parameters:
checkClash - whether to check for startup order clash
startConsumer - whether the route consumer should be started. Can be used to warmup the route without starting the consumer.
resumeConsumer - whether the route consumer should be resumed.
addingRoutes - whether we are adding new routes
routeServices - the routes
Throws:
Exception - is thrown if error starting the routes

safelyStartRouteServices

protected void safelyStartRouteServices(boolean forceAutoStart,
                                        boolean checkClash,
                                        boolean startConsumer,
                                        boolean resumeConsumer,
                                        boolean addingRoutes,
                                        RouteService... routeServices)
                                 throws Exception
Throws:
Exception
See Also:
safelyStartRouteServices(boolean,boolean,boolean,boolean,java.util.Collection)

forceLazyInitialization

protected void forceLazyInitialization()
Force some lazy initialization to occur upfront before we start any components and create routes


forceStopLazyInitialization

protected void forceStopLazyInitialization()
Force clear lazy initialization so they can be re-created on restart


createTypeConverter

protected TypeConverter createTypeConverter()
Lazily create a default implementation


createInjector

protected Injector createInjector()
Lazily create a default implementation


createManagementMBeanAssembler

protected ManagementMBeanAssembler createManagementMBeanAssembler()
Lazily create a default implementation


createComponentResolver

protected ComponentResolver createComponentResolver()
Lazily create a default implementation


createRegistry

protected Registry createRegistry()
Lazily create a default implementation


createEndpoint

protected Endpoint createEndpoint(String uri)
A pluggable strategy to allow an endpoint to be created without requiring a component to be its factory, such as for looking up the URI inside some Registry

Parameters:
uri - the uri for the endpoint to be created
Returns:
the newly created endpoint or null if it could not be resolved

convertBeanToEndpoint

protected Endpoint convertBeanToEndpoint(String uri,
                                         Object bean)
Strategy method for attempting to convert the bean from a Registry to an endpoint using some kind of transformation or wrapper

Parameters:
uri - the uri for the endpoint (and name in the registry)
bean - the bean to be converted to an endpoint, which will be not null
Returns:
a new endpoint

shouldStartRoutes

protected boolean shouldStartRoutes()
Should we start newly added routes?


getPropertiesComponent

protected PropertiesComponent getPropertiesComponent()
Gets the properties component in use. Returns null if no properties component is in use.


setDataFormats

public void setDataFormats(Map<String,DataFormatDefinition> dataFormats)
Description copied from interface: ModelCamelContext
Sets the data formats that can be referenced in the routes.

Specified by:
setDataFormats in interface CamelContext
Specified by:
setDataFormats in interface ModelCamelContext
Parameters:
dataFormats - the data formats

getDataFormats

public Map<String,DataFormatDefinition> getDataFormats()
Description copied from interface: ModelCamelContext
Gets the data formats that can be referenced in the routes.

Specified by:
getDataFormats in interface CamelContext
Specified by:
getDataFormats in interface ModelCamelContext
Returns:
the data formats available

getProperties

public Map<String,String> getProperties()
Description copied from interface: CamelContext
Gets the properties that can be referenced in the camel context

Specified by:
getProperties in interface CamelContext
Returns:
the properties

setProperties

public void setProperties(Map<String,String> properties)
Description copied from interface: CamelContext
Sets the properties that can be referenced in the camel context

Specified by:
setProperties in interface CamelContext
Parameters:
properties - properties

getDefaultFactoryFinder

public FactoryFinder getDefaultFactoryFinder()
Description copied from interface: CamelContext
Gets the default FactoryFinder which will be used for the loading the factory class from META-INF

Specified by:
getDefaultFactoryFinder in interface CamelContext
Returns:
the default factory finder

setFactoryFinderResolver

public void setFactoryFinderResolver(FactoryFinderResolver resolver)
Description copied from interface: CamelContext
Sets the factory finder resolver to use.

Specified by:
setFactoryFinderResolver in interface CamelContext
Parameters:
resolver - the factory finder resolver

getFactoryFinder

public FactoryFinder getFactoryFinder(String path)
                               throws NoFactoryAvailableException
Description copied from interface: CamelContext
Gets the FactoryFinder which will be used for the loading the factory class from META-INF in the given path

Specified by:
getFactoryFinder in interface CamelContext
Parameters:
path - the META-INF path
Returns:
the factory finder
Throws:
NoFactoryAvailableException - is thrown if a factory could not be found

getClassResolver

public ClassResolver getClassResolver()
Description copied from interface: CamelContext
Returns the class resolver to be used for loading/lookup of classes.

Specified by:
getClassResolver in interface CamelContext
Returns:
the resolver

setClassResolver

public void setClassResolver(ClassResolver classResolver)
Description copied from interface: CamelContext
Sets the class resolver to be use

Specified by:
setClassResolver in interface CamelContext
Parameters:
classResolver - the resolver

getPackageScanClassResolver

public PackageScanClassResolver getPackageScanClassResolver()
Description copied from interface: CamelContext
Returns the package scanning class resolver

Specified by:
getPackageScanClassResolver in interface CamelContext
Returns:
the resolver

setPackageScanClassResolver

public void setPackageScanClassResolver(PackageScanClassResolver packageScanClassResolver)
Description copied from interface: CamelContext
Sets the package scanning class resolver to use

Specified by:
setPackageScanClassResolver in interface CamelContext
Parameters:
packageScanClassResolver - the resolver

getComponentNames

public List<String> getComponentNames()
Description copied from interface: CamelContext
Gets a readonly list of names of the components currently registered

Specified by:
getComponentNames in interface CamelContext
Returns:
a readonly list with the names of the the components

getLanguageNames

public List<String> getLanguageNames()
Description copied from interface: CamelContext
Gets a readonly list with the names of the languages currently registered.

Specified by:
getLanguageNames in interface CamelContext
Returns:
a readonly list with the names of the the languages

getNodeIdFactory

public NodeIdFactory getNodeIdFactory()
Description copied from interface: CamelContext
Gets the node id factory

Specified by:
getNodeIdFactory in interface CamelContext
Returns:
the node id factory

setNodeIdFactory

public void setNodeIdFactory(NodeIdFactory idFactory)
Description copied from interface: CamelContext
Uses a custom node id factory when generating auto assigned ids to the nodes in the route definitions

Specified by:
setNodeIdFactory in interface CamelContext
Parameters:
idFactory - custom factory to use

getManagementStrategy

public ManagementStrategy getManagementStrategy()
Description copied from interface: CamelContext
Gets the management strategy

Specified by:
getManagementStrategy in interface CamelContext
Returns:
the management strategy

setManagementStrategy

public void setManagementStrategy(ManagementStrategy managementStrategy)
Description copied from interface: CamelContext
Sets the management strategy to use

Specified by:
setManagementStrategy in interface CamelContext
Parameters:
managementStrategy - the management strategy

getDefaultTracer

public InterceptStrategy getDefaultTracer()
Description copied from interface: CamelContext
Gets the default tracer

Specified by:
getDefaultTracer in interface CamelContext
Returns:
the default tracer

setDefaultTracer

public void setDefaultTracer(InterceptStrategy defaultTracer)
Description copied from interface: CamelContext
Sets a custom tracer to be used as the default tracer.

Note: This must be set before any routes are created, changing the defaultTracer for existing routes is not supported.

Specified by:
setDefaultTracer in interface CamelContext
Parameters:
defaultTracer - the custom tracer to use as default tracer

disableJMX

public void disableJMX()
Description copied from interface: CamelContext
Disables using JMX as ManagementStrategy.

Specified by:
disableJMX in interface CamelContext

getInflightRepository

public InflightRepository getInflightRepository()
Description copied from interface: CamelContext
Gets the inflight repository

Specified by:
getInflightRepository in interface CamelContext
Returns:
the repository

setInflightRepository

public void setInflightRepository(InflightRepository repository)
Description copied from interface: CamelContext
Sets a custom inflight repository to use

Specified by:
setInflightRepository in interface CamelContext
Parameters:
repository - the repository

setAutoStartup

public void setAutoStartup(Boolean autoStartup)
Description copied from interface: RuntimeConfiguration
Sets whether the object should automatically start when Camel starts.

Currently only routes can be disabled, as CamelContexts are always started.
Default is true to always start up.

Specified by:
setAutoStartup in interface RuntimeConfiguration
Parameters:
autoStartup - whether to start up automatically.

isAutoStartup

public Boolean isAutoStartup()
Description copied from interface: RuntimeConfiguration
Gets whether the object should automatically start when Camel starts.

Specified by:
isAutoStartup in interface RuntimeConfiguration
Returns:
true if object should automatically start

isLazyLoadTypeConverters

@Deprecated
public Boolean isLazyLoadTypeConverters()
Deprecated. 

Description copied from interface: CamelContext
Whether or not type converters should be loaded lazy

Specified by:
isLazyLoadTypeConverters in interface CamelContext
Returns:
true to load lazy, false to load on startup

setLazyLoadTypeConverters

@Deprecated
public void setLazyLoadTypeConverters(Boolean lazyLoadTypeConverters)
Deprecated. 

Description copied from interface: CamelContext
Sets whether type converters should be loaded lazy

Specified by:
setLazyLoadTypeConverters in interface CamelContext
Parameters:
lazyLoadTypeConverters - true to load lazy, false to load on startup

isTypeConverterStatisticsEnabled

public Boolean isTypeConverterStatisticsEnabled()
Description copied from interface: CamelContext
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.

Specified by:
isTypeConverterStatisticsEnabled in interface CamelContext
Returns:
true if enabled, false if disabled (default).

setTypeConverterStatisticsEnabled

public void setTypeConverterStatisticsEnabled(Boolean typeConverterStatisticsEnabled)
Description copied from interface: CamelContext
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 org.apache.camel.spi.TypeConverterRegistry#getStatistics()#setTypeConverterStatisticsEnabled(Boolean) method, or from JMX on the ManagedTypeConverterRegistryMBean mbean.

Specified by:
setTypeConverterStatisticsEnabled in interface CamelContext
Parameters:
typeConverterStatisticsEnabled - true to enable, false to disable

isUseMDCLogging

public Boolean isUseMDCLogging()
Description copied from interface: CamelContext
Whether or not MDC logging is being enabled.

Specified by:
isUseMDCLogging in interface CamelContext
Returns:
true if MDC logging is enabled

setUseMDCLogging

public void setUseMDCLogging(Boolean useMDCLogging)
Description copied from interface: CamelContext
Set whether MDC is enabled.

Specified by:
setUseMDCLogging in interface CamelContext
Parameters:
useMDCLogging - true to enable MDC logging, false to disable

isUseBreadcrumb

public Boolean isUseBreadcrumb()
Description copied from interface: CamelContext
Whether or not breadcrumb is enabled.

Specified by:
isUseBreadcrumb in interface CamelContext
Returns:
true if breadcrumb is enabled

setUseBreadcrumb

public void setUseBreadcrumb(Boolean useBreadcrumb)
Description copied from interface: CamelContext
Set whether breadcrumb is enabled.

Specified by:
setUseBreadcrumb in interface CamelContext
Parameters:
useBreadcrumb - true to enable breadcrumb, false to disable

getApplicationContextClassLoader

public ClassLoader getApplicationContextClassLoader()
Description copied from interface: CamelContext
Gets the the application context class loader which may be helpful for running camel in other containers

Specified by:
getApplicationContextClassLoader in interface CamelContext
Returns:
the application context class loader

setApplicationContextClassLoader

public void setApplicationContextClassLoader(ClassLoader classLoader)
Description copied from interface: CamelContext
Sets the application context class loader

Specified by:
setApplicationContextClassLoader in interface CamelContext
Parameters:
classLoader - the class loader

getDataFormatResolver

public DataFormatResolver getDataFormatResolver()
Description copied from interface: CamelContext
Gets the current data format resolver

Specified by:
getDataFormatResolver in interface CamelContext
Returns:
the resolver

setDataFormatResolver

public void setDataFormatResolver(DataFormatResolver dataFormatResolver)
Description copied from interface: CamelContext
Sets a custom data format resolver

Specified by:
setDataFormatResolver in interface CamelContext
Parameters:
dataFormatResolver - the resolver

resolveDataFormat

public DataFormat resolveDataFormat(String name)
Description copied from interface: CamelContext
Resolve a data format given its name

Specified by:
resolveDataFormat in interface CamelContext
Parameters:
name - the data format name or a reference to it in the Registry
Returns:
the resolved data format, or null if not found

resolveDataFormatDefinition

public DataFormatDefinition resolveDataFormatDefinition(String name)
Description copied from interface: ModelCamelContext
Resolve a data format definition given its name

Specified by:
resolveDataFormatDefinition in interface CamelContext
Specified by:
resolveDataFormatDefinition in interface ModelCamelContext
Parameters:
name - the data format definition name or a reference to it in the Registry
Returns:
the resolved data format definition, or null if not found

lookupPropertiesComponent

protected Component lookupPropertiesComponent()

getShutdownStrategy

public ShutdownStrategy getShutdownStrategy()
Description copied from interface: CamelContext
Gets the current shutdown strategy

Specified by:
getShutdownStrategy in interface CamelContext
Returns:
the strategy

setShutdownStrategy

public void setShutdownStrategy(ShutdownStrategy shutdownStrategy)
Description copied from interface: CamelContext
Sets a custom shutdown strategy

Specified by:
setShutdownStrategy in interface CamelContext
Parameters:
shutdownStrategy - the custom strategy

getShutdownRoute

public ShutdownRoute getShutdownRoute()
Description copied from interface: RuntimeConfiguration
Gets the option to use when shutting down the route.

Specified by:
getShutdownRoute in interface RuntimeConfiguration
Returns:
the option

setShutdownRoute

public void setShutdownRoute(ShutdownRoute shutdownRoute)
Description copied from interface: RuntimeConfiguration
Sets the ShutdownRoute option for routes.

Specified by:
setShutdownRoute in interface RuntimeConfiguration
Parameters:
shutdownRoute - the option to use.

getShutdownRunningTask

public ShutdownRunningTask getShutdownRunningTask()
Description copied from interface: RuntimeConfiguration
Gets the ShutdownRunningTask option in use when shutting down a route.

Specified by:
getShutdownRunningTask in interface RuntimeConfiguration
Returns:
the option

setShutdownRunningTask

public void setShutdownRunningTask(ShutdownRunningTask shutdownRunningTask)
Description copied from interface: RuntimeConfiguration
Sets the ShutdownRunningTask option to use when shutting down a route.

Specified by:
setShutdownRunningTask in interface RuntimeConfiguration
Parameters:
shutdownRunningTask - the option to use.

getExecutorServiceManager

public ExecutorServiceManager getExecutorServiceManager()
Description copied from interface: CamelContext
Gets the current ExecutorServiceManager

Specified by:
getExecutorServiceManager in interface CamelContext
Returns:
the manager

getExecutorServiceStrategy

@Deprecated
public ExecutorServiceStrategy getExecutorServiceStrategy()
Deprecated. 

Description copied from interface: CamelContext
Gets the current ExecutorServiceStrategy

Specified by:
getExecutorServiceStrategy in interface CamelContext
Returns:
the manager

setExecutorServiceManager

public void setExecutorServiceManager(ExecutorServiceManager executorServiceManager)
Description copied from interface: CamelContext
Sets a custom ExecutorServiceManager

Specified by:
setExecutorServiceManager in interface CamelContext
Parameters:
executorServiceManager - the custom manager

getProcessorFactory

public ProcessorFactory getProcessorFactory()
Description copied from interface: CamelContext
Gets the current ProcessorFactory

Specified by:
getProcessorFactory in interface CamelContext
Returns:
the factory, can be null if no custom factory has been set

setProcessorFactory

public void setProcessorFactory(ProcessorFactory processorFactory)
Description copied from interface: CamelContext
Sets a custom ProcessorFactory

Specified by:
setProcessorFactory in interface CamelContext
Parameters:
processorFactory - the custom factory

getDebugger

public Debugger getDebugger()
Description copied from interface: CamelContext
Gets the current Debugger

Specified by:
getDebugger in interface CamelContext
Returns:
the debugger

setDebugger

public void setDebugger(Debugger debugger)
Description copied from interface: CamelContext
Sets a custom Debugger

Specified by:
setDebugger in interface CamelContext
Parameters:
debugger - the debugger

getUuidGenerator

public UuidGenerator getUuidGenerator()
Description copied from interface: CamelContext
Gets the current UuidGenerator

Specified by:
getUuidGenerator in interface CamelContext
Returns:
the uuidGenerator

setUuidGenerator

public void setUuidGenerator(UuidGenerator uuidGenerator)
Description copied from interface: CamelContext
Sets a custom UuidGenerator (should only be set once)

Specified by:
setUuidGenerator in interface CamelContext
Parameters:
uuidGenerator - the UUID Generator

getRouteServices

protected Map<String,RouteService> getRouteServices()

createManagementStrategy

protected ManagementStrategy createManagementStrategy()

toString

public String toString()
Overrides:
toString in class Object

setContextCounter

public static void setContextCounter(int value)
Reset context counter to a preset value. Mostly used for tests to ensure a predictable getName()

Parameters:
value - new value for the context counter


Apache CAMEL