public class RoutingSlip extends ServiceSupport implements AsyncProcessor, Traceable, IdAware
Pipeline in the async variation
as the failover load balancer is a specialized pipeline. So the trick is to keep doing the same as the
pipeline to ensure it works the same and the async routing engine is flawless.| Modifier and Type | Class and Description |
|---|---|
protected static interface |
RoutingSlip.RoutingSlipIterator
The iterator to be used for retrieving the next routing slip(s) to be used.
|
| Modifier and Type | Field and Description |
|---|---|
protected int |
cacheSize |
protected CamelContext |
camelContext |
protected AsyncProcessor |
errorHandler |
protected Expression |
expression |
protected String |
header |
protected String |
id |
protected boolean |
ignoreInvalidEndpoints |
protected org.slf4j.Logger |
log |
protected ProducerCache |
producerCache |
protected SendDynamicProcessor |
sendDynamicProcessor |
protected String |
uriDelimiter |
shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending| Constructor and Description |
|---|
RoutingSlip(CamelContext camelContext) |
RoutingSlip(CamelContext camelContext,
Expression expression,
String uriDelimiter) |
| Modifier and Type | Method and Description |
|---|---|
protected AsyncProcessor |
createErrorHandler(RouteContext routeContext,
Exchange exchange,
AsyncProcessor processor,
Endpoint endpoint) |
protected RoutingSlip.RoutingSlipIterator |
createRoutingSlipIterator(Exchange exchange,
Expression expression)
Creates the route slip iterator to be used.
|
boolean |
doRoutingSlip(Exchange exchange,
Object routingSlip,
AsyncCallback callback) |
protected void |
doShutdown()
Implementations override this method to perform customized shutdown.
|
protected void |
doStart()
Implementations override this method to support customized start/stop.
|
protected void |
doStop()
Implementations override this method to support customized start/stop.
|
int |
getCacheSize() |
EndpointUtilizationStatistics |
getEndpointUtilizationStatistics() |
AsyncProcessor |
getErrorHandler() |
Expression |
getExpression() |
String |
getId()
Returns the id
|
String |
getTraceLabel()
Gets the trace label used for logging when tracing is enabled.
|
String |
getUriDelimiter() |
boolean |
isIgnoreInvalidEndpoints() |
AsyncProcessor |
newRoutingSlipProcessorForErrorHandler()
Creates the embedded processor to use when wrapping this routing slip in an error handler.
|
protected Exchange |
prepareExchangeForRoutingSlip(Exchange current,
Endpoint endpoint) |
void |
process(Exchange exchange)
Processes the message exchange
|
boolean |
process(Exchange exchange,
AsyncCallback callback)
Processes the message exchange.
|
protected boolean |
processExchange(Endpoint endpoint,
Exchange exchange,
Exchange original,
AsyncCallback originalCallback,
RoutingSlip.RoutingSlipIterator iter) |
protected Endpoint |
resolveEndpoint(RoutingSlip.RoutingSlipIterator iter,
Exchange exchange) |
void |
setCacheSize(int cacheSize) |
void |
setDelimiter(String delimiter) |
void |
setErrorHandler(AsyncProcessor errorHandler) |
void |
setId(String id)
Sets the id
|
void |
setIgnoreInvalidEndpoints(boolean ignoreInvalidEndpoints) |
String |
toString() |
doResume, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendprotected final org.slf4j.Logger log
protected ProducerCache producerCache
protected int cacheSize
protected boolean ignoreInvalidEndpoints
protected Expression expression
protected String uriDelimiter
protected final CamelContext camelContext
protected AsyncProcessor errorHandler
protected SendDynamicProcessor sendDynamicProcessor
public RoutingSlip(CamelContext camelContext)
public RoutingSlip(CamelContext camelContext, Expression expression, String uriDelimiter)
public Expression getExpression()
public String getUriDelimiter()
public void setDelimiter(String delimiter)
public boolean isIgnoreInvalidEndpoints()
public void setIgnoreInvalidEndpoints(boolean ignoreInvalidEndpoints)
public int getCacheSize()
public void setCacheSize(int cacheSize)
public AsyncProcessor getErrorHandler()
public void setErrorHandler(AsyncProcessor errorHandler)
public String getTraceLabel()
TraceablegetTraceLabel in interface Traceablepublic void process(Exchange exchange) throws Exception
Processorpublic boolean process(Exchange exchange, AsyncCallback callback)
AsyncProcessorProcessor.process(org.apache.camel.Exchange), but the caller supports having the exchange asynchronously processed.
If there was a failure processing then the caused Exception would be set on the Exchange.process in interface AsyncProcessorexchange - the message exchangecallback - the AsyncCallback will be invoked when the processing of the exchange is completed.
If the exchange is completed synchronously, then the callback is also invoked synchronously.
The callback should therefore be careful of starting recursive loop.public boolean doRoutingSlip(Exchange exchange, Object routingSlip, AsyncCallback callback)
protected RoutingSlip.RoutingSlipIterator createRoutingSlipIterator(Exchange exchange, Expression expression) throws Exception
exchange - the exchangeexpression - the expressionExceptionprotected Endpoint resolveEndpoint(RoutingSlip.RoutingSlipIterator iter, Exchange exchange) throws Exception
Exceptionprotected Exchange prepareExchangeForRoutingSlip(Exchange current, Endpoint endpoint)
protected AsyncProcessor createErrorHandler(RouteContext routeContext, Exchange exchange, AsyncProcessor processor, Endpoint endpoint)
protected boolean processExchange(Endpoint endpoint, Exchange exchange, Exchange original, AsyncCallback originalCallback, RoutingSlip.RoutingSlipIterator iter)
protected void doStart() throws Exception
ServiceSupportServiceSupport.doStop() for more details.doStart in class ServiceSupportExceptionServiceSupport.doStop()protected void doStop() throws Exception
ServiceSupportServiceSupport.doStop() method when
the service is being stopped. This method will also be invoked
if the service is still in uninitialized state (eg has not
been started). The method is always called to allow the service
to do custom logic when the service is being stopped, such as when
CamelContext is shutting down.doStop in class ServiceSupportExceptionServiceSupport.doStart()protected void doShutdown() throws Exception
ServiceSupportdoShutdown in class ServiceSupportExceptionpublic EndpointUtilizationStatistics getEndpointUtilizationStatistics()
public AsyncProcessor newRoutingSlipProcessorForErrorHandler()
Apache Camel