|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.camel.support.ServiceSupport org.apache.camel.processor.loadbalancer.LoadBalancerSupport org.apache.camel.processor.loadbalancer.FailOverLoadBalancer
public class FailOverLoadBalancer
This FailOverLoadBalancer will failover to use next processor when an exception occurred
This implementation mirrors the logic from thePipeline
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.
Field Summary |
---|
Fields inherited from class org.apache.camel.processor.loadbalancer.LoadBalancerSupport |
---|
log |
Fields inherited from class org.apache.camel.support.ServiceSupport |
---|
shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending |
Constructor Summary | |
---|---|
FailOverLoadBalancer()
|
|
FailOverLoadBalancer(List<Class<?>> exceptions)
|
Method Summary | |
---|---|
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()
|
Methods inherited from class org.apache.camel.processor.loadbalancer.LoadBalancerSupport |
---|
addProcessor, doStart, doStop, getProcessors, hasNext, next, process, removeProcessor |
Methods inherited from class org.apache.camel.support.ServiceSupport |
---|
doResume, doShutdown, doSuspend, getStatus, getVersion, isStarted, isStarting, isStopped, isStopping, isSuspended, isSuspending, resume, shutdown, start, stop, suspend |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FailOverLoadBalancer()
public FailOverLoadBalancer(List<Class<?>> exceptions)
Method Detail |
---|
public CamelContext getCamelContext()
CamelContextAware
CamelContext
getCamelContext
in interface CamelContextAware
public void setCamelContext(CamelContext camelContext)
CamelContextAware
CamelContext
setCamelContext
in interface CamelContextAware
camelContext
- the Camel contextpublic List<Class<?>> getExceptions()
public boolean isRoundRobin()
public void setRoundRobin(boolean roundRobin)
public int getMaximumFailoverAttempts()
public void setMaximumFailoverAttempts(int maximumFailoverAttempts)
protected boolean shouldFailOver(Exchange exchange)
exchange
- the exchange that failed
public boolean isRunAllowed()
StatefulService
isRunAllowed
in interface StatefulService
isRunAllowed
in class ServiceSupport
public boolean process(Exchange exchange, AsyncCallback callback)
AsyncProcessor
Processor.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 AsyncProcessor
exchange
- 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.
AsyncProcessorHelper.process(AsyncProcessor, Exchange, AsyncCallback)
protected Exchange prepareExchangeForFailover(Exchange exchange)
exchange
- the exchange
public String toString()
toString
in class Object
public String getTraceLabel()
Traceable
getTraceLabel
in interface Traceable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |