|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface CamelContext
Interface used to represent the context used to configure routes and the policies to use during message exchanges between endpoints.
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. |
|
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 |
addRouteDefinitions(Collection<RouteDefinition> routeDefinitions)
Adds a collection of route definitions to the context |
|
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, starting it so that it will be stopped with this context |
|
ConsumerTemplate |
createConsumerTemplate()
Creates a new ConsumerTemplate. |
|
ProducerTemplate |
createProducerTemplate()
Creates a new ProducerTemplate. |
|
void |
disableJMX()
Disables using JMX as ManagementStrategy . |
|
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 componentName)
Gets a component from the context by name. |
|
|
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 |
|
DataFormatResolver |
getDataFormatResolver()
Gets the current data format resolver |
|
Map<String,DataFormatDefinition> |
getDataFormats()
Gets the data formats that can be referenced in the routes. |
|
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 |
|
Endpoint |
getEndpoint(String uri)
Resolves the given name to an Endpoint of the specified type. |
|
|
getEndpoint(String name,
Class<T> endpointType)
Resolves the given name to an Endpoint of the specified type. |
|
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. |
|
Collection<Endpoint> |
getEndpoints(String uri)
Deprecated. not used will be removed in Camel 2.3. |
|
ErrorHandlerBuilder |
getErrorHandlerBuilder()
Gets the default error handler builder which is inherited by the routes |
|
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. |
|
List<LifecycleStrategy> |
getLifecycleStrategies()
Returns the lifecycle strategies used to handle lifecycle notifications |
|
ManagementStrategy |
getManagementStrategy()
Gets the management strategy |
|
String |
getName()
Gets the name of the this context. |
|
NodeIdFactory |
getNodeIdFactory()
Gets the node id factory |
|
Component |
getOrCreateComponent(String componentName,
Callable<Component> factory)
Deprecated. will be removed in Camel 2.3. |
|
PackageScanClassResolver |
getPackageScanClassResolver()
Returns the package scanning class resolver |
|
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 |
|
Registry |
getRegistry()
Returns the registry used to lookup components by name and type such as the Spring ApplicationContext, JNDI or the OSGi Service Registry |
|
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 |
|
ServiceStatus |
getRouteStatus(RouteDefinition route)
Deprecated. will be removed in Camel 2.3. |
|
ServiceStatus |
getRouteStatus(String routeId)
Returns the current status of the given route |
|
ShutdownStrategy |
getShutdownStrategy()
Gets the current shutdown strategy |
|
Collection<Endpoint> |
getSingletonEndpoints()
Deprecated. not used will be removed in Camel 2.3. |
|
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 |
getVersion()
Gets the version of the this context. |
|
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? |
|
Component |
removeComponent(String componentName)
Removes a previously added component. |
|
Collection<Endpoint> |
removeEndpoints(String uri)
Deprecated. not used will be removed in Camel 2.3. |
|
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 |
|
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 |
|
void |
setApplicationContextClassLoader(ClassLoader classLoader)
Sets the application context class loader |
|
void |
setClassResolver(ClassResolver resolver)
Sets the class resolver to be use |
|
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 |
setErrorHandlerBuilder(ErrorHandlerBuilder errorHandlerBuilder)
Sets the default error handler builder which is inherited by the routes |
|
void |
setFactoryFinderResolver(FactoryFinderResolver resolver)
Sets the factory finder resolver to use. |
|
void |
setInflightRepository(InflightRepository repository)
Sets a custom inflight repository to use |
|
void |
setManagementStrategy(ManagementStrategy strategy)
Sets the management strategy to use |
|
void |
setNodeIdFactory(NodeIdFactory factory)
Uses a custom node id factory when generating auto assigned ids to the nodes in the route definitions |
|
void |
setPackageScanClassResolver(PackageScanClassResolver resolver)
Sets the package scanning class resolver to use |
|
void |
setProducerServicePool(ServicePool<Endpoint,Producer> servicePool)
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 |
setShutdownStrategy(ShutdownStrategy shutdownStrategy)
Sets a custom shutdown strategy |
|
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 |
|
void |
stopRoute(RouteDefinition route)
Stops the given route. |
|
void |
stopRoute(String routeId)
Stops the given route. |
Methods inherited from interface org.apache.camel.Service |
---|
start, stop |
Methods inherited from interface org.apache.camel.RuntimeConfiguration |
---|
getDelayer, getShutdownRoute, getShutdownRunningTask, isAutoStartup, isHandleFault, isStreamCaching, isTracing, setAutoStartup, setDelayer, setHandleFault, setShutdownRoute, setShutdownRunningTask, setStreamCaching, setTracing |
Method Detail |
---|
String getName()
String getVersion()
void addService(Object object) throws Exception
object
- the service
Exception
- can be thrown when starting the serviceboolean hasService(Object object)
object
- the service
void addComponent(String componentName, Component component)
componentName
- the name the component is registered ascomponent
- the componentComponent hasComponent(String componentName)
componentName
- the name of the component
Component getComponent(String componentName)
componentName
- the name of the component
<T extends Component> T getComponent(String name, Class<T> componentType)
name
- the name to lookupcomponentType
- the expected type
List<String> getComponentNames()
Component removeComponent(String componentName)
componentName
- the component name to remove
@Deprecated Component getOrCreateComponent(String componentName, Callable<Component> factory)
componentName
- the name of the componentfactory
- used to create a new component instance if the component was not previously added.
Endpoint getEndpoint(String uri)
Endpoint
of the specified type.
If the name has a singleton endpoint registered, then the singleton is returned.
Otherwise, a new Endpoint
is created and registered.
uri
- the URI of the endpoint
<T extends Endpoint> T getEndpoint(String name, Class<T> endpointType)
Endpoint
of the specified type.
If the name has a singleton endpoint registered, then the singleton is returned.
Otherwise, a new Endpoint
is created and registered.
name
- the name of the endpointendpointType
- the expected type
Collection<Endpoint> getEndpoints()
Map<String,Endpoint> getEndpointMap()
Endpoint hasEndpoint(String uri)
uri
- the URI of the endpoint
@Deprecated Collection<Endpoint> getEndpoints(String uri)
uri
- the URI of the endpoints
@Deprecated Collection<Endpoint> getSingletonEndpoints()
Endpoint addEndpoint(String uri, Endpoint endpoint) throws Exception
uri
- the URI to be used to resolve this endpointendpoint
- the endpoint to be added to the context
Exception
- if the new endpoint could not be started or the old endpoint could not be stopped@Deprecated Collection<Endpoint> removeEndpoints(String uri) throws Exception
uri
- the URI to be used to remove
Exception
- if at least one endpoint could not be stoppedvoid addRegisterEndpointCallback(EndpointStrategy strategy)
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
strategy
- callback to be invokedList<RouteDefinition> getRouteDefinitions()
RouteDefinition getRouteDefinition(String id)
id
- id of the route
List<Route> getRoutes()
void addRoutes(RoutesBuilder builder) throws Exception
builder
- the builder which will create the routes and add them to this context
Exception
- if the routes could not be created for whatever reasonvoid addRouteDefinitions(Collection<RouteDefinition> routeDefinitions) throws Exception
routeDefinitions
- the route definitions to add
Exception
- if the route definition could not be created for whatever reasonvoid removeRouteDefinitions(Collection<RouteDefinition> routeDefinitions) throws Exception
routeDefinitions
- route definitions
Exception
- if the route definition could not be removed for whatever reasonvoid startRoute(RouteDefinition route) throws Exception
route
- the route to start
Exception
- is thrown if the route could not be started for whatever reasonvoid startRoute(String routeId) throws Exception
routeId
- the route id
Exception
- is thrown if the route could not be started for whatever reasonvoid stopRoute(RouteDefinition route) throws Exception
getRouteDefinitions()
unless you use the removeRouteDefinitions(java.util.Collection)
route
- the route to stop
Exception
- is thrown if the route could not be stopped for whatever reasonvoid stopRoute(String routeId) throws Exception
getRouteDefinitions()
unless you use the removeRouteDefinitions(java.util.Collection)
routeId
- the route id
Exception
- is thrown if the route could not be stopped for whatever reasonServiceStatus getRouteStatus(String routeId)
routeId
- the route id
@Deprecated ServiceStatus getRouteStatus(RouteDefinition route)
route
- the route
TypeConverter getTypeConverter()
TypeConverterRegistry getTypeConverterRegistry()
Registry getRegistry()
Injector getInjector()
List<LifecycleStrategy> getLifecycleStrategies()
void addLifecycleStrategy(LifecycleStrategy lifecycleStrategy)
lifecycleStrategy
- the strategyLanguage resolveLanguage(String language)
language
- name of the language
List<String> getLanguageNames()
ProducerTemplate createProducerTemplate()
ConsumerTemplate createConsumerTemplate()
void addInterceptStrategy(InterceptStrategy interceptStrategy)
interceptStrategy
- the strategyList<InterceptStrategy> getInterceptStrategies()
ErrorHandlerBuilder getErrorHandlerBuilder()
void setErrorHandlerBuilder(ErrorHandlerBuilder errorHandlerBuilder)
errorHandlerBuilder
- the buildervoid setDataFormats(Map<String,DataFormatDefinition> dataFormats)
dataFormats
- the data formatsMap<String,DataFormatDefinition> getDataFormats()
DataFormat resolveDataFormat(String name)
name
- the data format name or a reference to it in the Registry
DataFormatDefinition resolveDataFormatDefinition(String name)
name
- the data format definition name or a reference to it in the Registry
DataFormatResolver getDataFormatResolver()
void setDataFormatResolver(DataFormatResolver dataFormatResolver)
dataFormatResolver
- the resolvervoid setProperties(Map<String,String> properties)
properties
- propertiesMap<String,String> getProperties()
FactoryFinder getDefaultFactoryFinder()
void setFactoryFinderResolver(FactoryFinderResolver resolver)
resolver
- the factory finder resolverFactoryFinder getFactoryFinder(String path) throws NoFactoryAvailableException
path
- the META-INF path
NoFactoryAvailableException
- is thrown if a factory could not be foundClassResolver getClassResolver()
PackageScanClassResolver getPackageScanClassResolver()
void setClassResolver(ClassResolver resolver)
resolver
- the resolvervoid setPackageScanClassResolver(PackageScanClassResolver resolver)
resolver
- the resolvervoid setProducerServicePool(ServicePool<Endpoint,Producer> servicePool)
Producer
pooling.
servicePool
- the poolServicePool<Endpoint,Producer> getProducerServicePool()
Producer
pooling.
void setNodeIdFactory(NodeIdFactory factory)
factory
- custom factory to useNodeIdFactory getNodeIdFactory()
ManagementStrategy getManagementStrategy()
void setManagementStrategy(ManagementStrategy strategy)
strategy
- the management strategyInterceptStrategy getDefaultTracer()
void disableJMX()
ManagementStrategy
.
InflightRepository getInflightRepository()
void setInflightRepository(InflightRepository repository)
repository
- the repositoryClassLoader getApplicationContextClassLoader()
void setApplicationContextClassLoader(ClassLoader classLoader)
classLoader
- the class loaderShutdownStrategy getShutdownStrategy()
void setShutdownStrategy(ShutdownStrategy shutdownStrategy)
shutdownStrategy
- the custom strategy
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |