public class FailOverLoadBalancer extends LoadBalancerSupport implements Traceable, CamelContextAware
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.logshutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending| Constructor and Description |
|---|
FailOverLoadBalancer() |
FailOverLoadBalancer(List<Class<?>> exceptions) |
| Modifier and Type | Method and Description |
|---|---|
CamelContext |
getCamelContext()
Get the
CamelContext |
List<Class<?>> |
getExceptions() |
int |
getMaximumFailoverAttempts() |
String |
getTraceLabel()
Gets the trace label used for logging when tracing is enabled.
|
boolean |
isRoundRobin() |
boolean |
isRunAllowed()
Helper methods so the service knows if it should keep running.
|
protected Exchange |
prepareExchangeForFailover(Exchange exchange)
Prepares the exchange for failover
|
boolean |
process(Exchange exchange,
AsyncCallback callback)
Processes the message exchange.
|
void |
setCamelContext(CamelContext camelContext)
Injects the
CamelContext |
void |
setMaximumFailoverAttempts(int maximumFailoverAttempts) |
void |
setRoundRobin(boolean roundRobin) |
protected boolean |
shouldFailOver(Exchange exchange)
Should the given failed Exchange failover?
|
String |
toString() |
addProcessor, doShutdown, doStart, doStop, getId, getProcessors, hasNext, next, process, removeProcessor, setIddoResume, doSuspend, getStatus, getVersion, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendpublic CamelContext getCamelContext()
CamelContextAwareCamelContextgetCamelContext in interface CamelContextAwarepublic void setCamelContext(CamelContext camelContext)
CamelContextAwareCamelContextsetCamelContext in interface CamelContextAwarecamelContext - the Camel contextpublic boolean isRoundRobin()
public void setRoundRobin(boolean roundRobin)
public int getMaximumFailoverAttempts()
public void setMaximumFailoverAttempts(int maximumFailoverAttempts)
protected boolean shouldFailOver(Exchange exchange)
exchange - the exchange that failedpublic boolean isRunAllowed()
StatefulServiceisRunAllowed in interface StatefulServiceisRunAllowed in class ServiceSupportpublic 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.protected Exchange prepareExchangeForFailover(Exchange exchange)
exchange - the exchangepublic String getTraceLabel()
TraceablegetTraceLabel in interface TraceableApache Camel