public abstract class AbstractBasicRoute
extends org.apache.camel.spring.SpringRouteBuilder
Modifier and Type | Field and Description |
---|---|
static String |
EXTERNAL_ROUTE_SUFFIX
Suffix for outbound routes with external systems.
|
static String |
IN_ROUTE_SUFFIX
Suffix for asynchronous incoming routes.
|
static String |
OUT_ROUTE_SUFFIX
Suffix for asynchronous outbound routes.
|
static String |
ROUTE_ID_DELIMITER
Delimiter in generated route id for service and operation name.
|
static String |
ROUTE_SUFFIX
Suffix for synchronous routes.
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractBasicRoute() |
Modifier and Type | Method and Description |
---|---|
protected void |
addEventNotifier(org.apache.camel.spi.EventNotifier eventNotifier)
Adds new event notifier.
|
void |
configure() |
protected abstract void |
doConfigure()
Defines routes and route specific configuration.
|
protected void |
doErrorHandling()
Defines global (better to say semi-global because it's scoped for one route builder) exception policy
and common error handling.
|
String |
exceptionHandling(Exception ex,
Boolean asynch)
Handles specified exception.
|
protected <T> T |
getBean(Class<T> type)
Returns bean by its type from registry.
|
static String |
getExternalRouteId(ExternalSystemExtEnum system,
String operationName)
Gets route ID for routes which communicates with external systems.
|
static String |
getInRouteId(ServiceExtEnum service,
String operationName)
Gets route ID for asynchronous incoming routes.
|
protected String |
getInWsUri(QName qName)
Gets "from" URI for handling incoming WS messages with default '' bean.
|
protected String |
getInWsUri(QName qName,
String params)
Gets "from" URI for handling incoming WS messages with default '' bean.
|
static String |
getOutRouteId(ServiceExtEnum service,
String operationName)
Gets route ID for asynchronous outbound routes.
|
protected String |
getOutWsSoap12Uri(String connectionUri,
String messageSenderRef)
Shorthand for
getOutWsSoap12Uri(String, String, String) . |
protected String |
getOutWsSoap12Uri(String connectionUri,
String messageSenderRef,
String soapAction)
Constructs a "to" URI for sending WS messages to external systems,
i.e., Camel Web Service Endpoint URI for contacting an external system via SOAP 1.2.
|
protected String |
getOutWsUri(String connectionUri,
String messageSenderRef)
Shorthand for
getOutWsUri(String, String, String) . |
protected String |
getOutWsUri(String connectionUri,
String messageSenderRef,
String soapAction)
Constructs a "to" URI for sending WS messages to external systems,
i.e., Camel Web Service Endpoint URI for contacting an external system via SOAP 1.1.
|
static String |
getRouteId(ServiceExtEnum service,
String operationName)
Gets route ID for synchronous routes.
|
boolean |
isAsynch(Boolean asynch) |
void |
printMessageHistory(org.apache.camel.Exchange exchange) |
String |
toString()
Returns class name of the route implementation class.
|
getApplicationContext, lookup, lookup, setApplicationContext, transactionErrorHandler, transactionErrorHandler, transactionErrorHandler, transactionErrorHandler
addRoutes, addRoutesToCamelContext, checkInitialized, configureRest, configureRests, configureRoute, configureRoutes, createContainer, errorHandler, from, from, from, from, fromF, getContext, getRestCollection, getRestConfigurations, getRouteCollection, includeRoutes, intercept, interceptFrom, interceptFrom, interceptSendToEndpoint, onCompletion, onException, onException, populateRests, populateRoutes, rest, rest, restConfiguration, restConfiguration, setErrorHandlerBuilder, setRestCollection, setRouteCollection
bean, bean, bean, bean, body, body, bodyAs, constant, createErrorHandlerBuilder, deadLetterChannel, deadLetterChannel, defaultErrorHandler, endpoint, endpoint, endpoints, endpoints, exceptionMessage, exchangeProperty, faultBody, faultBodyAs, getErrorHandlerBuilder, header, language, loggingErrorHandler, loggingErrorHandler, loggingErrorHandler, loggingErrorHandler, method, method, method, method, noErrorHandler, outBody, outBody, property, regexReplaceAll, regexReplaceAll, sendTo, setContext, setContext, simple, simple, simpleF, simpleF, systemProperty, systemProperty, xpath, xpath
public static final String ROUTE_SUFFIX
public static final String IN_ROUTE_SUFFIX
public static final String OUT_ROUTE_SUFFIX
public static final String EXTERNAL_ROUTE_SUFFIX
public static final String ROUTE_ID_DELIMITER
public final void configure() throws Exception
configure
in class org.apache.camel.builder.RouteBuilder
Exception
protected void doErrorHandling() throws Exception
Default implementation catches common Exception
and if it's synchronous message
(see AsynchConstants.ASYNCH_MSG_HEADER
) then redirect to AsynchConstants.URI_EX_TRANSLATION
.
If it's asynchronous message then determines according to exception's type if redirect to
AsynchConstants.URI_ERROR_FATAL
or AsynchConstants.URI_ERROR_HANDLING
route URI.
Exception
- can be thrown during configuration@Handler public void printMessageHistory(org.apache.camel.Exchange exchange)
@Handler public boolean isAsynch(@Header(value="asynchMsgProcessing") Boolean asynch)
@Handler public String exceptionHandling(Exception ex, @Header(value="asynchMsgProcessing") Boolean asynch)
ex
- the thrown exceptionasynch
- true
if it's asynchronous message processing otherwise synchronous processingprotected abstract void doConfigure() throws Exception
Exception
- can be thrown during configurationprotected String getOutWsUri(String connectionUri, String messageSenderRef, String soapAction)
connectionUri
- the URI to connect to the external system, e.g.: http://localhost:8080/vfmock/ws/mm7messageSenderRef
- the message sender ref (bean id/name in Spring context)soapAction
- the SOAP action to be invoked,
can be null
for implicit handling of SOAP messages by the external systemprotected String getOutWsUri(String connectionUri, String messageSenderRef)
getOutWsUri(String, String, String)
.connectionUri
- the URI connectionmessageSenderRef
- the reference of message senderprotected String getOutWsSoap12Uri(String connectionUri, String messageSenderRef)
getOutWsSoap12Uri(String, String, String)
.connectionUri
- the URI connectionmessageSenderRef
- the reference of message senderprotected String getOutWsSoap12Uri(String connectionUri, String messageSenderRef, String soapAction)
connectionUri
- the URI to connect to the external system, e.g.: http://localhost:8080/vfmock/ws/mm7messageSenderRef
- the message sender ref (bean id/name in Spring context)soapAction
- the SOAP action to be invoked,
can be null
for implicit handling of SOAP messages by the external systemprotected String getInWsUri(QName qName)
qName
- the operation QName (namespace + local part)protected String getInWsUri(QName qName, @Nullable String params)
qName
- the operation QName (namespace + local part)params
- the endpoint URI parameters (without leading signs ? or &)public static String getRouteId(ServiceExtEnum service, String operationName)
service
- the service nameoperationName
- the operation namegetInRouteId(ServiceExtEnum, String)
,
getOutRouteId(ServiceExtEnum, String)
,
getExternalRouteId(ExternalSystemExtEnum, String)
public static String getInRouteId(ServiceExtEnum service, String operationName)
service
- the service nameoperationName
- the operation namegetOutRouteId(ServiceExtEnum, String)
public static String getOutRouteId(ServiceExtEnum service, String operationName)
service
- the service nameoperationName
- the operation namegetInRouteId(ServiceExtEnum, String)
public static String getExternalRouteId(ExternalSystemExtEnum system, String operationName)
system
- the external systemoperationName
- the operation namegetRouteId(ServiceExtEnum, String)
protected final void addEventNotifier(org.apache.camel.spi.EventNotifier eventNotifier)
Use manual adding via this method or use EventNotifier
annotation
for automatic registration. Don't use both.
eventNotifier
- the event notifierprotected final <T> T getBean(Class<T> type)
T
- as class of typetype
- the type of the registered beanpublic String toString()
This is because of using bean(this, "createResponseForGetCounterData")
- if there is no toString()
method then StackOverflowError
is thrown.
toString
in class org.apache.camel.builder.RouteBuilder
Copyright © 2018 Pivotal Software, Inc.. All rights reserved.