Package org.apache.camel.builder
Class TemplatedRouteBuilder
- java.lang.Object
-
- org.apache.camel.builder.TemplatedRouteBuilder
-
public final class TemplatedRouteBuilder extends Object
Fluent builder for adding new routes from route templates.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
add()
Adds the route to theCamelContext
which is built from the configured route template.TemplatedRouteBuilder
bean(String id, Class<?> type, Object bean)
Binds the bean to the template local repository (takes precedence over global beans)TemplatedRouteBuilder
bean(String id, Class<?> type, Supplier<Object> bean)
Binds the bean (via a supplier) to the template local repository (takes precedence over global beans)TemplatedRouteBuilder
bean(String id, Object bean)
Binds the bean to the template local repository (takes precedence over global beans)static TemplatedRouteBuilder
builder(org.apache.camel.CamelContext camelContext, String routeTemplateId)
Creates a newTemplatedRouteBuilder
to specify input parameters, and others, for the route template.TemplatedRouteBuilder
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.TemplatedRouteBuilder
handler(Consumer<RouteTemplateDefinition> handler)
Sets a handler which gives access to the route template model that will be used for creating the route.TemplatedRouteBuilder
parameter(String name, Object value)
Adds a parameter the route template will use when creating the route.TemplatedRouteBuilder
parameters(Map<String,Object> parameters)
Adds parameters the route template will use when creating the route.TemplatedRouteBuilder
prefixId(String prefixId)
Sets a prefix to use for all node ids (not route id).TemplatedRouteBuilder
routeId(String routeId)
Sets the id of the route.
-
-
-
Method Detail
-
builder
public static TemplatedRouteBuilder builder(org.apache.camel.CamelContext camelContext, String routeTemplateId)
Creates a newTemplatedRouteBuilder
to specify input parameters, and others, for the route template.- Parameters:
camelContext
- the camel contextrouteTemplateId
- the id of the route template- Returns:
- the builder
-
routeId
public TemplatedRouteBuilder routeId(String routeId)
Sets the id of the route. If no route id is configured, then Camel will auto assign a route id, which is returned from the build method.- Parameters:
routeId
- the route id
-
prefixId
public TemplatedRouteBuilder prefixId(String prefixId)
Sets a prefix to use for all node ids (not route id).- Parameters:
prefixId
- the prefix id
-
parameter
public TemplatedRouteBuilder parameter(String name, Object value)
Adds a parameter the route template will use when creating the route.- Parameters:
name
- parameter namevalue
- parameter value
-
parameters
public TemplatedRouteBuilder parameters(Map<String,Object> parameters)
Adds parameters the route template will use when creating the route.- Parameters:
parameters
- the template parameters to add
-
bean
public TemplatedRouteBuilder bean(String id, Object bean)
Binds the bean to the template local repository (takes precedence over global beans)- Parameters:
id
- the id of the beanbean
- the bean
-
bean
public TemplatedRouteBuilder bean(String id, Class<?> type, Object bean)
Binds the bean to the template local repository (takes precedence over global beans)- Parameters:
id
- the id of the beantype
- the type of the bean to associate the bindingbean
- the bean
-
bean
public TemplatedRouteBuilder bean(String id, Class<?> type, Supplier<Object> bean)
Binds the bean (via a supplier) to the template local repository (takes precedence over global beans)- Parameters:
id
- the id of the beantype
- the type of the bean to associate the bindingbean
- the bean
-
handler
public TemplatedRouteBuilder handler(Consumer<RouteTemplateDefinition> handler)
Sets a handler which gives access to the route template model that will be used for creating the route. This can be used to do validation. Any changes to the model happens before the route is created and added, however these changes affect future usage of the same template.- Parameters:
handler
- the handler with callback to invoke with the given route template
-
configure
public TemplatedRouteBuilder 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
-
add
public String add()
Adds the route to theCamelContext
which is built from the configured route template.- Returns:
- the route id of the route that was added.
-
-