public class LoadBalancerDefinition extends IdentifiedType implements LoadBalancer
Modifier | Constructor and Description |
---|---|
|
LoadBalancerDefinition() |
|
LoadBalancerDefinition(LoadBalancer loadBalancer) |
protected |
LoadBalancerDefinition(String loadBalancerTypeName) |
Modifier and Type | Method and Description |
---|---|
void |
addProcessor(Processor processor)
Adds a new processor to the load balancer
|
protected void |
configureLoadBalancer(LoadBalancer loadBalancer)
Allows derived classes to customize the load balancer
|
protected LoadBalancer |
createLoadBalancer(RouteContext routeContext)
Factory method to create the load balancer instance
|
LoadBalancer |
getLoadBalancer(RouteContext routeContext) |
static LoadBalancer |
getLoadBalancer(RouteContext routeContext,
LoadBalancerDefinition type,
String ref) |
List<Processor> |
getProcessors()
Returns the current processors available to this load balancer
|
void |
process(Exchange exchange)
Processes the message exchange
|
boolean |
process(Exchange exchange,
AsyncCallback callback)
Processes the message exchange.
|
void |
removeProcessor(Processor processor)
Removes the given processor from the load balancer
|
protected void |
setProperty(Object bean,
String name,
Object value)
Sets a named property on the data format instance using introspection
|
String |
toString() |
getId, setId
public LoadBalancerDefinition()
public LoadBalancerDefinition(LoadBalancer loadBalancer)
protected LoadBalancerDefinition(String loadBalancerTypeName)
public static LoadBalancer getLoadBalancer(RouteContext routeContext, LoadBalancerDefinition type, String ref)
protected void setProperty(Object bean, String name, Object value)
protected void configureLoadBalancer(LoadBalancer loadBalancer)
public LoadBalancer getLoadBalancer(RouteContext routeContext)
protected LoadBalancer createLoadBalancer(RouteContext routeContext)
public void addProcessor(Processor processor)
LoadBalancer
addProcessor
in interface LoadBalancer
processor
- the processor to be added to the load balancerpublic List<Processor> getProcessors()
LoadBalancer
getProcessors
in interface LoadBalancer
public void removeProcessor(Processor processor)
LoadBalancer
removeProcessor
in interface LoadBalancer
processor
- the processor to be removed from the load balancerpublic void process(Exchange exchange) throws Exception
Processor
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.Apache Camel