Package org.apache.camel.model
Interface Model
-
- All Known Subinterfaces:
ModelCamelContext
- All Known Implementing Classes:
DefaultCamelContext,DefaultModel,LightweightCamelContext
public interface Model
Model interface
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddFaultToleranceConfiguration(String id, FaultToleranceConfigurationDefinition configuration)Adds the MicroProfile Fault Tolerance configurationvoidaddHystrixConfiguration(String id, HystrixConfigurationDefinition configuration)Adds the Hystrix configurationvoidaddResilience4jConfiguration(String id, Resilience4jConfigurationDefinition configuration)Adds the Resilience4j configurationvoidaddRestDefinitions(Collection<RestDefinition> restDefinitions, boolean addToRoutes)Adds a collection of rest definitions to the contextvoidaddRouteDefinition(RouteDefinition routeDefinition)Add a route definition to the contextvoidaddRouteDefinitions(Collection<RouteDefinition> routeDefinitions)Adds a collection of route definitions to the contextvoidaddServiceCallConfiguration(String serviceName, ServiceCallConfigurationDefinition configuration)Adds the service call configurationMap<String,DataFormatDefinition>getDataFormats()Gets the data formats that can be referenced in the routes.FaultToleranceConfigurationDefinitiongetFaultToleranceConfiguration(String id)Gets the MicroProfile Fault Tolerance configuration by the given name.HystrixConfigurationDefinitiongetHystrixConfiguration(String id)Gets the Hystrix configuration by the given name.ProcessorDefinition<?>getProcessorDefinition(String id)Gets the processor definition from any of the routes which with the given id<T extends ProcessorDefinition<T>>
TgetProcessorDefinition(String id, Class<T> type)Gets the processor definition from any of the routes which with the given idResilience4jConfigurationDefinitiongetResilience4jConfiguration(String id)Gets the Resilience4j configuration by the given name.List<RestDefinition>getRestDefinitions()Returns a list of the current REST definitionsRouteDefinitiongetRouteDefinition(String id)Gets the route definition with the given idList<RouteDefinition>getRouteDefinitions()Returns a list of the current route definitionsFunction<RouteDefinition,Boolean>getRouteFilter()Gets the current route filterServiceCallConfigurationDefinitiongetServiceCallConfiguration(String serviceName)Gets the service call configuration by the given name.List<TransformerDefinition>getTransformers()Gets the transformers that can be referenced in the routes.List<ValidatorDefinition>getValidators()Gets the validators that can be referenced in the routes.voidremoveRouteDefinition(RouteDefinition routeDefinition)Removes a route definition from the context - stopping any previously running routes if any of them are actively runningvoidremoveRouteDefinitions(Collection<RouteDefinition> routeDefinitions)Removes a collection of route definitions from the context - stopping any previously running routes if any of them are actively runningDataFormatDefinitionresolveDataFormatDefinition(String name)Resolve a data format definition given its namevoidsetDataFormats(Map<String,DataFormatDefinition> dataFormats)Sets the data formats that can be referenced in the routes.voidsetFaultToleranceConfiguration(FaultToleranceConfigurationDefinition configuration)Sets the default MicroProfile Fault Tolerance configurationvoidsetFaultToleranceConfigurations(List<FaultToleranceConfigurationDefinition> configurations)Sets the MicroProfile Fault Tolerance configurationsvoidsetHystrixConfiguration(HystrixConfigurationDefinition configuration)Sets the default Hystrix configurationvoidsetHystrixConfigurations(List<HystrixConfigurationDefinition> configurations)Sets the Hystrix configurationsvoidsetResilience4jConfiguration(Resilience4jConfigurationDefinition configuration)Sets the default Resilience4j configurationvoidsetResilience4jConfigurations(List<Resilience4jConfigurationDefinition> configurations)Sets the Resilience4j configurationsvoidsetRouteFilter(Function<RouteDefinition,Boolean> filter)Sets a custom route filter to use for filtering unwanted routes when routes are added.voidsetRouteFilterPattern(String include, String exclude)Used for filtering routes routes matching the given pattern, which follows the following rules: - Match by route id - Match by route input endpoint uri The matching is using exact match, by wildcard and regular expression as documented byPatternHelper.matchPattern(String, String).voidsetServiceCallConfiguration(ServiceCallConfigurationDefinition configuration)Sets the default service call configurationvoidsetServiceCallConfigurations(List<ServiceCallConfigurationDefinition> configurations)Sets the service call configurationsvoidsetTransformers(List<TransformerDefinition> transformers)Sets the transformers that can be referenced in the routes.voidsetValidators(List<ValidatorDefinition> validators)Sets the validators that can be referenced in the routes.
-
-
-
Method Detail
-
getRouteDefinitions
List<RouteDefinition> getRouteDefinitions()
Returns a list of the current route definitions- Returns:
- list of the current route definitions
-
getRouteDefinition
RouteDefinition getRouteDefinition(String id)
Gets the route definition with the given id- Parameters:
id- id of the route- Returns:
- the route definition or null if not found
-
addRouteDefinitions
void addRouteDefinitions(Collection<RouteDefinition> routeDefinitions) throws Exception
Adds a collection of route definitions to the context Important: Each route in the sameCamelContextmust have an unique route id. If you use the API fromCamelContextorModelto add routes, then any new routes which has a route id that matches an old route, then the old route is replaced by the new route.- Parameters:
routeDefinitions- the route(s) definition to add- Throws:
Exception- if the route definitions could not be added for whatever reason
-
addRouteDefinition
void addRouteDefinition(RouteDefinition routeDefinition) throws Exception
Add a route definition to the context Important: Each route in the sameCamelContextmust have an unique route id. If you use the API fromCamelContextorModelto add routes, then any new routes which has a route id that matches an old route, then the old route is replaced by the new route.- Parameters:
routeDefinition- the route definition to add- Throws:
Exception- if the route definition could not be added for whatever reason
-
removeRouteDefinitions
void removeRouteDefinitions(Collection<RouteDefinition> routeDefinitions) throws Exception
Removes a collection of route definitions from the context - stopping any previously running routes if any of them are actively running- Parameters:
routeDefinitions- route(s) definitions to remove- Throws:
Exception- if the route definitions could not be removed for whatever reason
-
removeRouteDefinition
void removeRouteDefinition(RouteDefinition routeDefinition) throws Exception
Removes a route definition from the context - stopping any previously running routes if any of them are actively running- Parameters:
routeDefinition- route definition to remove- Throws:
Exception- if the route definition could not be removed for whatever reason
-
getRestDefinitions
List<RestDefinition> getRestDefinitions()
Returns a list of the current REST definitions- Returns:
- list of the current REST definitions
-
addRestDefinitions
void addRestDefinitions(Collection<RestDefinition> restDefinitions, boolean addToRoutes) throws Exception
Adds a collection of rest definitions to the context- Parameters:
restDefinitions- the rest(s) definition to addaddToRoutes- whether the rests should also automatically be added as routes- Throws:
Exception- if the rest definitions could not be created for whatever reason
-
setDataFormats
void setDataFormats(Map<String,DataFormatDefinition> dataFormats)
Sets the data formats that can be referenced in the routes.- Parameters:
dataFormats- the data formats
-
getDataFormats
Map<String,DataFormatDefinition> getDataFormats()
Gets the data formats that can be referenced in the routes.- Returns:
- the data formats available
-
resolveDataFormatDefinition
DataFormatDefinition resolveDataFormatDefinition(String name)
Resolve a data format definition given its name- Parameters:
name- the data format definition name or a reference to it in theRegistry- Returns:
- the resolved data format definition, or null if not found
-
getProcessorDefinition
ProcessorDefinition<?> getProcessorDefinition(String id)
Gets the processor definition from any of the routes which with the given id- Parameters:
id- id of the processor definition- Returns:
- the processor definition or null if not found
-
getProcessorDefinition
<T extends ProcessorDefinition<T>> T getProcessorDefinition(String id, Class<T> type)
Gets the processor definition from any of the routes which with the given id- Parameters:
id- id of the processor definitiontype- the processor definition type- Returns:
- the processor definition or null if not found
- Throws:
ClassCastException- is thrown if the type is not correct type
-
setValidators
void setValidators(List<ValidatorDefinition> validators)
Sets the validators that can be referenced in the routes.- Parameters:
validators- the validators
-
getHystrixConfiguration
HystrixConfigurationDefinition getHystrixConfiguration(String id)
Gets the Hystrix configuration by the given name. If no name is given the default configuration is returned, see setHystrixConfiguration- Parameters:
id- id of the configuration, or null to return the default configuration- Returns:
- the configuration, or null if no configuration has been registered
-
setHystrixConfiguration
void setHystrixConfiguration(HystrixConfigurationDefinition configuration)
Sets the default Hystrix configuration- Parameters:
configuration- the configuration
-
setHystrixConfigurations
void setHystrixConfigurations(List<HystrixConfigurationDefinition> configurations)
Sets the Hystrix configurations- Parameters:
configurations- the configuration list
-
addHystrixConfiguration
void addHystrixConfiguration(String id, HystrixConfigurationDefinition configuration)
Adds the Hystrix configuration- Parameters:
id- name of the configurationconfiguration- the configuration
-
getResilience4jConfiguration
Resilience4jConfigurationDefinition getResilience4jConfiguration(String id)
Gets the Resilience4j configuration by the given name. If no name is given the default configuration is returned, see setResilience4jConfiguration- Parameters:
id- id of the configuration, or null to return the default configuration- Returns:
- the configuration, or null if no configuration has been registered
-
setResilience4jConfiguration
void setResilience4jConfiguration(Resilience4jConfigurationDefinition configuration)
Sets the default Resilience4j configuration- Parameters:
configuration- the configuration
-
setResilience4jConfigurations
void setResilience4jConfigurations(List<Resilience4jConfigurationDefinition> configurations)
Sets the Resilience4j configurations- Parameters:
configurations- the configuration list
-
addResilience4jConfiguration
void addResilience4jConfiguration(String id, Resilience4jConfigurationDefinition configuration)
Adds the Resilience4j configuration- Parameters:
id- name of the configurationconfiguration- the configuration
-
getFaultToleranceConfiguration
FaultToleranceConfigurationDefinition getFaultToleranceConfiguration(String id)
Gets the MicroProfile Fault Tolerance configuration by the given name. If no name is given the default configuration is returned, see setFaultToleranceConfigurationDefinition- Parameters:
id- id of the configuration, or null to return the default configuration- Returns:
- the configuration, or null if no configuration has been registered
-
setFaultToleranceConfiguration
void setFaultToleranceConfiguration(FaultToleranceConfigurationDefinition configuration)
Sets the default MicroProfile Fault Tolerance configuration- Parameters:
configuration- the configuration
-
setFaultToleranceConfigurations
void setFaultToleranceConfigurations(List<FaultToleranceConfigurationDefinition> configurations)
Sets the MicroProfile Fault Tolerance configurations- Parameters:
configurations- the configuration list
-
addFaultToleranceConfiguration
void addFaultToleranceConfiguration(String id, FaultToleranceConfigurationDefinition configuration)
Adds the MicroProfile Fault Tolerance configuration- Parameters:
id- name of the configurationconfiguration- the configuration
-
getValidators
List<ValidatorDefinition> getValidators()
Gets the validators that can be referenced in the routes.- Returns:
- the validators available
-
setTransformers
void setTransformers(List<TransformerDefinition> transformers)
Sets the transformers that can be referenced in the routes.- Parameters:
transformers- the transformers
-
getTransformers
List<TransformerDefinition> getTransformers()
Gets the transformers that can be referenced in the routes.- Returns:
- the transformers available
-
getServiceCallConfiguration
ServiceCallConfigurationDefinition getServiceCallConfiguration(String serviceName)
Gets the service call configuration by the given name. If no name is given the default configuration is returned, see setServiceCallConfiguration- Parameters:
serviceName- name of service, or null to return the default configuration- Returns:
- the configuration, or null if no configuration has been registered
-
setServiceCallConfiguration
void setServiceCallConfiguration(ServiceCallConfigurationDefinition configuration)
Sets the default service call configuration- Parameters:
configuration- the configuration
-
setServiceCallConfigurations
void setServiceCallConfigurations(List<ServiceCallConfigurationDefinition> configurations)
Sets the service call configurations- Parameters:
configurations- the configuration list
-
addServiceCallConfiguration
void addServiceCallConfiguration(String serviceName, ServiceCallConfigurationDefinition configuration)
Adds the service call configuration- Parameters:
serviceName- name of the serviceconfiguration- the configuration
-
setRouteFilterPattern
void setRouteFilterPattern(String include, String exclude)
Used for filtering routes routes matching the given pattern, which follows the following rules: - Match by route id - Match by route input endpoint uri The matching is using exact match, by wildcard and regular expression as documented byPatternHelper.matchPattern(String, String). For example to only include routes which starts with foo in their route id's, use: include=foo* And to exclude routes which starts from JMS endpoints, use: exclude=jms:* Exclude takes precedence over include.- Parameters:
include- the include patternexclude- the exclude pattern
-
setRouteFilter
void setRouteFilter(Function<RouteDefinition,Boolean> filter)
Sets a custom route filter to use for filtering unwanted routes when routes are added.- Parameters:
filter- the filter
-
getRouteFilter
Function<RouteDefinition,Boolean> getRouteFilter()
Gets the current route filter- Returns:
- the filter, or null if no custom filter has been configured.
-
-