public abstract class RouteBuilder extends BuilderSupport implements RoutesBuilder
Modifier and Type | Field and Description |
---|---|
protected org.slf4j.Logger |
log |
Constructor and Description |
---|
RouteBuilder() |
RouteBuilder(CamelContext context) |
Modifier and Type | Method and Description |
---|---|
protected void |
addRoutes(RoutesBuilder routes)
Deprecated.
will be removed in Camel 3.0. Instead use
includeRoutes instead. |
void |
addRoutesToCamelContext(CamelContext context)
Adds the routes from this Route Builder to the CamelContext.
|
protected void |
checkInitialized() |
abstract void |
configure()
Called on initialization to build the routes using the fluent builder syntax.
This is a central method for RouteBuilder implementations to implement
the routes using the Java fluent builder syntax.
|
protected void |
configureRest(RestDefinition rest) |
RestsDefinition |
configureRests(ModelCamelContext context)
Configures the rests
|
protected void |
configureRoute(RouteDefinition route) |
RoutesDefinition |
configureRoutes(ModelCamelContext context)
Configures the routes
|
protected ModelCamelContext |
createContainer()
Factory method
|
void |
errorHandler(ErrorHandlerBuilder errorHandlerBuilder)
Installs the given error handler builder
|
RouteDefinition |
from(Endpoint... endpoints)
Creates a new route from the given endpoint
|
RouteDefinition |
from(Endpoint endpoint)
Creates a new route from the given endpoint
|
RouteDefinition |
from(String... uris)
Creates a new route from the given URIs input
|
RouteDefinition |
from(String uri)
Creates a new route from the given URI input
|
RouteDefinition |
fromF(String uri,
Object... args)
Creates a new route from the given URI input
|
ModelCamelContext |
getContext() |
RestsDefinition |
getRestCollection() |
RestConfigurationDefinition |
getRestConfiguration() |
RoutesDefinition |
getRouteCollection() |
void |
includeRoutes(RoutesBuilder routes)
Includes the routes from the build to this builder.
|
InterceptDefinition |
intercept()
Adds a route for an interceptor that intercepts every processing step.
|
InterceptFromDefinition |
interceptFrom()
Adds a route for an interceptor that intercepts incoming messages on any inputs in this route
|
InterceptFromDefinition |
interceptFrom(String uri)
Adds a route for an interceptor that intercepts incoming messages on the given endpoint.
|
InterceptSendToEndpointDefinition |
interceptSendToEndpoint(String uri)
Applies a route for an interceptor if an exchange is send to the given endpoint
|
OnCompletionDefinition |
onCompletion()
On completion
callback for doing custom routing when the
Exchange is complete. |
OnExceptionDefinition |
onException(Class<? extends Throwable>... exceptions)
Exception clause
for catching certain exceptions and handling them.
|
OnExceptionDefinition |
onException(Class<? extends Throwable> exception)
Exception clause
for catching certain exceptions and handling them.
|
protected void |
populateRests() |
protected void |
populateRoutes() |
RestDefinition |
rest()
Creates a new REST service
|
RestDefinition |
rest(String path)
Creates a new REST service
|
RestConfigurationDefinition |
restConfiguration()
Configures the REST services
|
void |
setErrorHandlerBuilder(ErrorHandlerBuilder errorHandlerBuilder)
Sets the error handler to use with processors created by this builder
|
void |
setRestCollection(RestsDefinition restCollection) |
void |
setRouteCollection(RoutesDefinition routeCollection) |
String |
toString() |
bean, bean, bean, bean, body, body, constant, createErrorHandlerBuilder, deadLetterChannel, deadLetterChannel, defaultErrorHandler, endpoint, endpoint, endpoints, endpoints, exceptionMessage, faultBody, faultBodyAs, getErrorHandlerBuilder, header, language, loggingErrorHandler, loggingErrorHandler, loggingErrorHandler, loggingErrorHandler, method, method, method, method, noErrorHandler, outBody, outBody, property, regexReplaceAll, regexReplaceAll, sendTo, setContext, setContext, simple, simple, systemProperty, systemProperty, xpath, xpath
protected org.slf4j.Logger log
public RouteBuilder()
public RouteBuilder(CamelContext context)
public abstract void configure() throws Exception
Exception
- can be thrown during configurationpublic RestConfigurationDefinition restConfiguration()
public RestDefinition rest()
public RestDefinition rest(String path)
path
- the base pathpublic RouteDefinition from(String uri)
uri
- the from uripublic RouteDefinition fromF(String uri, Object... args)
uri
- the String formatted from uriargs
- arguments for the string formatting of the uripublic RouteDefinition from(Endpoint endpoint)
endpoint
- the from endpointpublic RouteDefinition from(String... uris)
uris
- the from urispublic RouteDefinition from(Endpoint... endpoints)
endpoints
- the from endpointspublic void errorHandler(ErrorHandlerBuilder errorHandlerBuilder)
errorHandlerBuilder
- the error handler to be used by default for all child routespublic InterceptDefinition intercept()
public InterceptFromDefinition interceptFrom()
public InterceptFromDefinition interceptFrom(String uri)
uri
- endpoint uripublic InterceptSendToEndpointDefinition interceptSendToEndpoint(String uri)
uri
- endpoint uripublic OnExceptionDefinition onException(Class<? extends Throwable> exception)
exception
- exception to catchpublic OnExceptionDefinition onException(Class<? extends Throwable>... exceptions)
exceptions
- list of exceptions to catchpublic OnCompletionDefinition onCompletion()
Exchange
is complete.public ModelCamelContext getContext()
getContext
in class BuilderSupport
public void addRoutesToCamelContext(CamelContext context) throws Exception
RoutesBuilder
addRoutesToCamelContext
in interface RoutesBuilder
context
- the Camel contextException
- is thrown if initialization of routes failedpublic RoutesDefinition configureRoutes(ModelCamelContext context) throws Exception
context
- the Camel contextException
- can be thrown during configurationpublic RestsDefinition configureRests(ModelCamelContext context) throws Exception
context
- the Camel contextException
- can be thrown during configurationpublic void includeRoutes(RoutesBuilder routes) throws Exception
routes
- other builder with routes to includeException
- can be thrown during configurationpublic void setErrorHandlerBuilder(ErrorHandlerBuilder errorHandlerBuilder)
BuilderSupport
setErrorHandlerBuilder
in class BuilderSupport
protected void checkInitialized() throws Exception
Exception
protected void populateRoutes() throws Exception
Exception
protected void populateRests() throws Exception
Exception
public RestsDefinition getRestCollection()
public RestConfigurationDefinition getRestConfiguration()
public void setRestCollection(RestsDefinition restCollection)
public void setRouteCollection(RoutesDefinition routeCollection)
public RoutesDefinition getRouteCollection()
protected ModelCamelContext createContainer()
protected void configureRest(RestDefinition rest)
protected void configureRoute(RouteDefinition route)
@Deprecated protected void addRoutes(RoutesBuilder routes) throws Exception
includeRoutes
instead.routes
- the routesException
- if the routes could not be created for whatever reasonApache Camel