@Metadata(label="eip,routing") public class LoadBalanceDefinition extends ProcessorDefinition<LoadBalanceDefinition>
inheritErrorHandler, log
Constructor and Description |
---|
LoadBalanceDefinition() |
Modifier and Type | Method and Description |
---|---|
LoadBalanceDefinition |
circuitBreaker(int threshold,
long halfOpenAfter,
Class<?>... exceptions)
Uses circuitBreaker load balancer
|
Processor |
createProcessor(RouteContext routeContext)
Override this in definition class and implement logic to create the processor
based on the definition model.
|
LoadBalanceDefinition |
custom(String ref)
Uses the custom load balancer
|
LoadBalanceDefinition |
failover()
Uses fail over load balancer
Will not round robin and inherit the error handler.
|
LoadBalanceDefinition |
failover(Class<?>... exceptions)
Uses fail over load balancer
Will not round robin and inherit the error handler.
|
LoadBalanceDefinition |
failover(int maximumFailoverAttempts,
boolean inheritErrorHandler,
boolean roundRobin,
boolean sticky,
Class<?>... exceptions)
Uses fail over load balancer
|
LoadBalanceDefinition |
failover(int maximumFailoverAttempts,
boolean inheritErrorHandler,
boolean roundRobin,
Class<?>... exceptions)
Uses fail over load balancer
|
String |
getLabel()
Returns a label to describe this node such as the expression if some kind of expression node
|
LoadBalancerDefinition |
getLoadBalancerType() |
List<ProcessorDefinition<?>> |
getOutputs() |
boolean |
isOutputSupported() |
LoadBalanceDefinition |
loadBalance(LoadBalancer loadBalancer)
Uses a custom load balancer
|
LoadBalanceDefinition |
random()
Uses random load balancer
|
LoadBalanceDefinition |
roundRobin()
Uses round robin load balancer
|
void |
setLoadBalancerType(LoadBalancerDefinition loadbalancer)
The load balancer to be used
|
void |
setOutputs(List<ProcessorDefinition<?>> outputs) |
LoadBalanceDefinition |
sticky(Expression correlationExpression)
Uses sticky load balancer
|
LoadBalanceDefinition |
topic()
Uses topic load balancer
|
String |
toString() |
LoadBalanceDefinition |
weighted(boolean roundRobin,
String distributionRatio)
Uses weighted load balancer
|
LoadBalanceDefinition |
weighted(boolean roundRobin,
String distributionRatio,
String distributionRatioDelimiter)
Uses weighted load balancer
|
addInterceptStrategies, addInterceptStrategy, addOutput, addRoutes, aggregate, aggregate, aggregate, aggregate, aop, attribute, bean, bean, bean, bean, bean, bean, bean, bean, beanRef, beanRef, beanRef, beanRef, beanRef, choice, clearOutput, configureChild, convertBodyTo, convertBodyTo, createChannel, createChildProcessor, createCompositeProcessor, createOutputsProcessor, createOutputsProcessor, createOutputsProcessorImpl, createProcessor, delay, delay, delay, doTry, dynamicRouter, dynamicRouter, end, endChoice, endDoTry, endParent, endRest, enrich, enrich, enrich, enrich, enrich, enrichRef, enrichRef, enrichRef, filter, filter, filter, filter, getIndex, getInterceptStrategies, getOtherAttributes, getParent, id, idempotentConsumer, idempotentConsumer, idempotentConsumer, inheritErrorHandler, inOnly, inOnly, inOnly, inOnly, inOnly, inOnly, inOut, inOut, inOut, inOut, inOut, inOut, isAbstract, isInheritErrorHandler, isTopLevelOnly, loadBalance, log, log, log, log, log, log, loop, loop, loop, makeProcessor, markRollbackOnly, markRollbackOnlyLast, marshal, marshal, marshal, marshal, multicast, multicast, multicast, onCompletion, onException, onException, pipeline, pipeline, pipeline, pipeline, placeholder, policy, policy, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrichRef, pollEnrichRef, preCreateProcessor, process, process, processRef, recipientList, recipientList, recipientList, recipientList, removeFaultHeader, removeHeader, removeHeaders, removeHeaders, removeProperties, removeProperties, removeProperty, resequence, resequence, rollback, rollback, routeDescription, routeId, routingSlip, routingSlip, routingSlip, routingSlip, routingSlip, routingSlip, routingSlip, sample, sample, sample, script, script, setBody, setBody, setExchangePattern, setFaultBody, setFaultHeader, setHeader, setHeader, setInheritErrorHandler, setOtherAttributes, setOutHeader, setOutHeader, setParent, setProperty, setProperty, sort, sort, sort, split, split, split, startupOrder, stop, threads, threads, threads, threads, throttle, throttle, throwException, throwException, to, to, to, to, to, to, to, to, to, to, toD, toD, toF, transacted, transacted, transform, transform, unmarshal, unmarshal, unmarshal, unmarshal, validate, validate, validate, wireTap, wireTap, wireTap, wireTap, wireTap, wireTap, wireTap, wireTap, wrapChannel, wrapInErrorHandler, wrapProcessor
description, description, getCustomId, getDescription, getDescriptionText, getId, getShortName, hasCustomIdAssigned, idOrCreate, setCustomId, setDescription, setId
public LoadBalanceDefinition()
public List<ProcessorDefinition<?>> getOutputs()
getOutputs
in class ProcessorDefinition<LoadBalanceDefinition>
public void setOutputs(List<ProcessorDefinition<?>> outputs)
public boolean isOutputSupported()
isOutputSupported
in class ProcessorDefinition<LoadBalanceDefinition>
public LoadBalancerDefinition getLoadBalancerType()
public void setLoadBalancerType(LoadBalancerDefinition loadbalancer)
public Processor createProcessor(RouteContext routeContext) throws Exception
ProcessorDefinition
createProcessor
in class ProcessorDefinition<LoadBalanceDefinition>
Exception
public LoadBalanceDefinition loadBalance(LoadBalancer loadBalancer)
loadBalance
in class ProcessorDefinition<LoadBalanceDefinition>
loadBalancer
- the load balancerpublic LoadBalanceDefinition failover()
public LoadBalanceDefinition failover(Class<?>... exceptions)
exceptions
- exception classes which we want to failover if one of them was thrownpublic LoadBalanceDefinition failover(int maximumFailoverAttempts, boolean inheritErrorHandler, boolean roundRobin, Class<?>... exceptions)
maximumFailoverAttempts
- maximum number of failover attempts before exhausting.
Use -1 to newer exhaust when round robin is also enabled.
If round robin is disabled then it will exhaust when there are no more endpoints to failoverinheritErrorHandler
- whether or not to inherit error handler.
If false then it will failover immediately in case of an exceptionroundRobin
- whether or not to use round robin (which keeps state)exceptions
- exception classes which we want to failover if one of them was thrownpublic LoadBalanceDefinition failover(int maximumFailoverAttempts, boolean inheritErrorHandler, boolean roundRobin, boolean sticky, Class<?>... exceptions)
maximumFailoverAttempts
- maximum number of failover attempts before exhausting.
Use -1 to newer exhaust when round robin is also enabled.
If round robin is disabled then it will exhaust when there are no more endpoints to failoverinheritErrorHandler
- whether or not to inherit error handler.
If false then it will failover immediately in case of an exceptionroundRobin
- whether or not to use round robin (which keeps state)sticky
- whether or not to use sticky (which keeps state)exceptions
- exception classes which we want to failover if one of them was thrownpublic LoadBalanceDefinition weighted(boolean roundRobin, String distributionRatio)
roundRobin
- used to set the processor selection algorithm.distributionRatio
- String of weighted ratios for distribution of messages.public LoadBalanceDefinition circuitBreaker(int threshold, long halfOpenAfter, Class<?>... exceptions)
threshold
- number of errors before failure.halfOpenAfter
- time interval in milliseconds for half open state.exceptions
- exception classes which we want to break if one of them was thrownpublic LoadBalanceDefinition weighted(boolean roundRobin, String distributionRatio, String distributionRatioDelimiter)
roundRobin
- used to set the processor selection algorithm.distributionRatio
- String of weighted ratios for distribution of messages.distributionRatioDelimiter
- String containing delimiter to be used for ratiospublic LoadBalanceDefinition roundRobin()
public LoadBalanceDefinition random()
public LoadBalanceDefinition custom(String ref)
ref
- reference to lookup a custom load balancer from the Registry
to be used.public LoadBalanceDefinition sticky(Expression correlationExpression)
correlationExpression
- the expression for correlationpublic LoadBalanceDefinition topic()
public String getLabel()
ProcessorDefinition
getLabel
in interface NamedNode
getLabel
in class ProcessorDefinition<LoadBalanceDefinition>
Apache Camel