|
||||||||||
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 |
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 |
|
ConsumerTemplate |
createConsumerTemplate()
Creates a new ConsumerTemplate. |
|
ProducerTemplate |
createProducerTemplate()
Creates a new ProducerTemplate. |
|
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 |
|
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 |
|
Endpoint |
getEndpoint(String uri)
Resolves the given URI to an Endpoint . |
|
|
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)
Returns the collection of all registered endpoints for a uri or an empty collection. |
|
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 |
|
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. |
|
LifecycleStrategy |
getLifecycleStrategy()
Returns the lifecycle strategy used to handle lifecycle notification |
|
String |
getName()
Gets the name of the this context. |
|
NodeIdFactory |
getNodeIdFactory()
Gets the node id factory |
|
Component |
getOrCreateComponent(String componentName,
Callable<Component> factory)
Gets the a previously added component by name or lazily creates the component using the factory Callback. |
|
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 |
|
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)
Returns the current status of the given route |
|
Collection<Endpoint> |
getSingletonEndpoints()
Returns the collection of all registered singleton endpoints. |
|
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 |
|
Endpoint |
hasEndpoint(String uri)
Is the given endpoint already registered? |
|
Component |
removeComponent(String componentName)
Removes a previously added component. |
|
Collection<Endpoint> |
removeEndpoints(String uri)
Removes all endpoints with the given URI |
|
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 |
|
Language |
resolveLanguage(String language)
Resolves a language for creating expressions |
|
void |
setClassResolver(ClassResolver resolver)
Sets the class resolver to be use |
|
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 |
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 |
startRoute(RouteDefinition route)
Starts the given route if it has been previously stopped |
|
void |
stopRoute(RouteDefinition route)
Stops the given route. |
Methods inherited from interface org.apache.camel.Service |
---|
start, stop |
Methods inherited from interface org.apache.camel.RuntimeConfiguration |
---|
getDelayer, isHandleFault, isStreamCaching, isTracing, setDelayer, setHandleFault, setStreamCaching, setTracing |
Method Detail |
---|
String getName()
void addComponent(String componentName, Component component)
componentName
- the name the component is registered ascomponent
- the componentComponent 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
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
. If the URI has a singleton endpoint
registered, then the singleton is returned. Otherwise, a new Endpoint
is created
and if the endpoint is a singleton it is registered as a singleton endpoint.
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 if the endpoint is a
singleton it is registered as a singleton endpoint.
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
Collection<Endpoint> getEndpoints(String uri)
uri
- the URI of the endpoints
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
singleton endpoint could not be stoppedCollection<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()
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 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 reasonTypeConverter getTypeConverter()
TypeConverterRegistry getTypeConverterRegistry()
Registry getRegistry()
Injector getInjector()
LifecycleStrategy getLifecycleStrategy()
Language 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()
void 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 foundServiceStatus getRouteStatus(RouteDefinition route)
route
- the route
ClassResolver 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()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |