Package org.apache.camel.model
Class RouteTemplateDefinition
java.lang.Object
org.apache.camel.model.OptionalIdentifiedDefinition<RouteTemplateDefinition>
org.apache.camel.model.RouteTemplateDefinition
- All Implemented Interfaces:
org.apache.camel.CamelContextAware
,org.apache.camel.LineNumberAware
,org.apache.camel.NamedNode
,org.apache.camel.spi.HasCamelContext
,org.apache.camel.spi.HasId
,org.apache.camel.spi.IdAware
,org.apache.camel.spi.ResourceAware
@Metadata(label="configuration")
public class RouteTemplateDefinition
extends OptionalIdentifiedDefinition<RouteTemplateDefinition>
implements org.apache.camel.spi.ResourceAware
Defines a route template (parameterized routes)
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates a copy of this template as aRouteDefinition
which can be used to add as a new route.Sets a configurer which allows to do configuration while the route template is being used to create a route.description
(String description) Sets the description of this nodeCreates an input to the routefrom
(EndpointConsumerBuilder endpoint) Creates an input to the routefrom
(org.apache.camel.Endpoint endpoint) Creates an input to the routeConsumer
<org.apache.camel.RouteTemplateContext> getLabel()
org.apache.camel.spi.Resource
getRoute()
route()
To define the route in the templatevoid
setConfigurer
(Consumer<org.apache.camel.RouteTemplateContext> configurer) void
setResource
(org.apache.camel.spi.Resource resource) void
setRoute
(RouteDefinition route) void
setTemplateBeans
(List<BeanFactoryDefinition<RouteTemplateDefinition>> templateBeans) void
setTemplateParameters
(List<RouteTemplateParameterDefinition> templateParameters) templateBean
(String name) Adds a local bean the route template uses (via fluent builder)templateBean
(String name, Class<?> type) Adds a local bean the route template usestemplateBean
(String name, Class<?> type, String language, String script) Adds a local bean the route template usestemplateBean
(String name, Class<?> type, org.apache.camel.RouteTemplateContext.BeanSupplier<Object> bean) Adds a local bean the route template usestemplateBean
(String name, Object bean) Adds a local bean the route template usestemplateBean
(String name, String language, String script) Adds a local bean the route template usestemplateBean
(String name, Supplier<Object> bean) Adds a local bean the route template usesAdds an optional parameter the route template usestemplateOptionalParameter
(String name, String description) Adds an optional parameter the route template usestemplateParameter
(String name) Adds a required parameter the route template usestemplateParameter
(String name, String defaultValue) Adds a parameter (will use default value if not provided) the route template usestemplateParameter
(String name, String defaultValue, String description) Adds a parameter (will use default value if not provided) the route template usestemplateParameters
(Map<String, String> parameters) Adds the parameters the route template uses.Methods inherited from class org.apache.camel.model.OptionalIdentifiedDefinition
getCamelContext, getCustomId, getDescription, getDescriptionText, getId, getLineNumber, getLocation, getNodePrefixId, getParent, hasCustomIdAssigned, id, idOrCreate, setCamelContext, setCustomId, setDescription, setGeneratedId, setId, setLineNumber, setLocation
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.camel.NamedNode
acceptDebugger
-
Constructor Details
-
RouteTemplateDefinition
public RouteTemplateDefinition()
-
-
Method Details
-
getTemplateParameters
-
setTemplateParameters
-
getTemplateBeans
-
setTemplateBeans
-
getRoute
-
setRoute
-
setConfigurer
-
getConfigurer
-
getResource
public org.apache.camel.spi.Resource getResource()- Specified by:
getResource
in interfaceorg.apache.camel.spi.ResourceAware
-
setResource
public void setResource(org.apache.camel.spi.Resource resource) - Specified by:
setResource
in interfaceorg.apache.camel.spi.ResourceAware
-
from
Creates an input to the route- Parameters:
uri
- the from uri- Returns:
- the builder
-
from
Creates an input to the route- Parameters:
endpoint
- the from endpoint- Returns:
- the builder
-
from
Creates an input to the route- Parameters:
endpoint
- the from endpoint- Returns:
- the builder
-
route
To define the route in the template -
description
Description copied from class:OptionalIdentifiedDefinition
Sets the description of this node- Overrides:
description
in classOptionalIdentifiedDefinition<RouteTemplateDefinition>
- Parameters:
description
- sets the text description, use null to not set a text- Returns:
- the builder
-
templateParameter
Adds a required parameter the route template uses- Parameters:
name
- the name of the parameter
-
templateOptionalParameter
Adds an optional parameter the route template uses- Parameters:
name
- the name of the parameter
-
templateOptionalParameter
Adds an optional parameter the route template uses- Parameters:
name
- the name of the parameterdescription
- the description of the parameter
-
templateParameter
Adds a parameter (will use default value if not provided) the route template uses- Parameters:
name
- the name of the parameterdefaultValue
- default value of the parameter
-
templateParameter
public RouteTemplateDefinition templateParameter(String name, String defaultValue, String description) Adds a parameter (will use default value if not provided) the route template uses- Parameters:
name
- the name of the parameterdefaultValue
- default value of the parameterdescription
- the description of the parameter
-
templateParameters
Adds the parameters the route template uses. The keys in the map is the parameter names, and the values are optional default value. If a parameter has no default value then the parameter is required.- Parameters:
parameters
- the parameters (only name and default values)
-
templateBean
Adds a local bean the route template uses- Parameters:
name
- the name of the beantype
- the type of the bean to associate the binding
-
templateBean
Adds a local bean the route template uses- Parameters:
name
- the name of the beanbean
- the bean, or reference to bean (#class or #type), or a supplier for the bean
-
templateBean
Adds a local bean the route template uses- Parameters:
name
- the name of the beanbean
- the supplier for the bean
-
templateBean
public RouteTemplateDefinition templateBean(String name, Class<?> type, org.apache.camel.RouteTemplateContext.BeanSupplier<Object> bean) Adds a local bean the route template uses- Parameters:
name
- the name of the beantype
- the type of the bean to associate the bindingbean
- a supplier for the bean
-
templateBean
Adds a local bean the route template uses- Parameters:
name
- the name of the beanlanguage
- the language to usescript
- the script to use for creating the local bean
-
templateBean
public RouteTemplateDefinition templateBean(String name, Class<?> type, String language, String script) Adds a local bean the route template uses- Parameters:
name
- the name of the beantype
- the type of the bean to associate the bindinglanguage
- the language to usescript
- the script to use for creating the local bean
-
templateBean
Adds a local bean the route template uses (via fluent builder)- Parameters:
name
- the name of the bean- Returns:
- fluent builder to choose which language and script to use for creating the bean
-
configure
public RouteTemplateDefinition configure(Consumer<org.apache.camel.RouteTemplateContext> configurer) Sets a configurer which allows to do configuration while the route template is being used to create a route. This gives control over the creating process, such as binding local beans and doing other kind of customization.- Parameters:
configurer
- the configurer with callback to invoke with the given route template context
-
getShortName
- Specified by:
getShortName
in interfaceorg.apache.camel.NamedNode
-
getLabel
- Specified by:
getLabel
in interfaceorg.apache.camel.NamedNode
-
asRouteDefinition
Creates a copy of this template as aRouteDefinition
which can be used to add as a new route.
-