org.apache.camel.model
Class LoadBalanceDefinition

java.lang.Object
  extended by org.apache.camel.model.OptionalIdentifiedDefinition
      extended by org.apache.camel.model.ProcessorDefinition<LoadBalanceDefinition>
          extended by org.apache.camel.model.LoadBalanceDefinition
All Implemented Interfaces:
Block

public class LoadBalanceDefinition
extends ProcessorDefinition<LoadBalanceDefinition>

Represents an XML <loadBalance/> element


Field Summary
 
Fields inherited from class org.apache.camel.model.ProcessorDefinition
errorHandlerBuilder, errorHandlerRef, inheritErrorHandler, log
 
Constructor Summary
LoadBalanceDefinition()
           
 
Method Summary
protected  Processor createOutputsProcessor(RouteContext routeContext, Collection<ProcessorDefinition> outputs)
           
 Processor createProcessor(RouteContext routeContext)
          Override this in definition class and implement logic to create the processor based on the definition model.
 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, 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()
           
 String getRef()
           
 String getShortName()
          Returns a short name for this node which can be useful for ID generation or referring to related resources like images
 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)
           
 void setOutputs(List<ProcessorDefinition> outputs)
           
 void setRef(String ref)
           
 LoadBalanceDefinition sticky(Expression correlationExpression)
          Uses sticky load balancer
 LoadBalanceDefinition topic()
          Uses topic load balancer
 String toString()
           
 
Methods inherited from class org.apache.camel.model.ProcessorDefinition
addInterceptStrategies, addInterceptStrategy, addOutput, addRoutes, aggregate, aggregate, aggregate, aggregate, aop, bean, bean, bean, bean, beanRef, beanRef, choice, clearOutput, configureChild, convertBodyTo, convertBodyTo, createChannel, createChildProcessor, createCompositeProcessor, createErrorHandlerBuilder, createOutputsProcessor, delay, delay, delay, doTry, end, enrich, enrich, enrichRef, filter, filter, filter, filter, getErrorHandlerBuilder, getInterceptStrategies, getNodeFactory, getParent, id, idempotentConsumer, idempotentConsumer, idempotentConsumer, inheritErrorHandler, inOnly, inOnly, inOnly, inOnly, inOnly, inOnly, inOut, inOut, inOut, inOut, inOut, inOut, isAbstract, isInheritErrorHandler, loadBalance, log, log, log, loop, loop, loop, makeProcessor, markRollbackOnly, markRollbackOnlyLast, marshal, marshal, marshal, marshal, multicast, multicast, multicast, onCompletion, onException, pipeline, pipeline, pipeline, pipeline, policy, policy, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrichRef, process, processRef, recipientList, recipientList, recipientList, removeFaultHeader, removeHeader, removeHeaders, removeProperty, resequence, resequence, resequence, resequence, rollback, rollback, routeId, routingSlip, routingSlip, routingSlip, routingSlip, routingSlip, routingSlip, routingSlip, sample, sample, setBody, setBody, setErrorHandlerBuilder, setExchangePattern, setFaultBody, setFaultHeader, setHeader, setHeader, setInheritErrorHandler, setNodeFactory, setOutHeader, setOutHeader, setParent, setProperty, setProperty, sort, sort, sortBody, sortBody, split, split, split, stop, threads, threads, threads, throttle, throwException, to, to, to, to, to, to, to, to, to, to, toF, transacted, transacted, transform, transform, unmarshal, unmarshal, unmarshal, unmarshal, validate, validate, validate, wireTap, wireTap, wireTap, wireTap, wireTap, wireTap, wireTap, wrapChannel, wrapInErrorHandler, wrapProcessor
 
Methods inherited from class org.apache.camel.model.OptionalIdentifiedDefinition
description, getDescription, getId, hasCustomIdAssigned, idOrCreate, setDescription, setId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LoadBalanceDefinition

public LoadBalanceDefinition()
Method Detail

getShortName

public String getShortName()
Description copied from class: OptionalIdentifiedDefinition
Returns a short name for this node which can be useful for ID generation or referring to related resources like images

Overrides:
getShortName in class OptionalIdentifiedDefinition
Returns:
defaults to "node" but derived nodes should overload this to provide a unique name

getOutputs

public List<ProcessorDefinition> getOutputs()
Specified by:
getOutputs in class ProcessorDefinition<LoadBalanceDefinition>

setOutputs

public void setOutputs(List<ProcessorDefinition> outputs)

getRef

public String getRef()

setRef

public void setRef(String ref)

getLoadBalancerType

public LoadBalancerDefinition getLoadBalancerType()

setLoadBalancerType

public void setLoadBalancerType(LoadBalancerDefinition loadbalancer)

createOutputsProcessor

protected Processor createOutputsProcessor(RouteContext routeContext,
                                           Collection<ProcessorDefinition> outputs)
                                    throws Exception
Overrides:
createOutputsProcessor in class ProcessorDefinition<LoadBalanceDefinition>
Throws:
Exception

createProcessor

public Processor createProcessor(RouteContext routeContext)
                          throws Exception
Description copied from class: ProcessorDefinition
Override this in definition class and implement logic to create the processor based on the definition model.

Overrides:
createProcessor in class ProcessorDefinition<LoadBalanceDefinition>
Throws:
Exception

loadBalance

public LoadBalanceDefinition loadBalance(LoadBalancer loadBalancer)
Uses a custom load balancer

Overrides:
loadBalance in class ProcessorDefinition<LoadBalanceDefinition>
Parameters:
loadBalancer - the load balancer
Returns:
the builder

failover

public LoadBalanceDefinition failover()
Uses fail over load balancer

Will not round robin and inherit the error handler.

Returns:
the builder

failover

public LoadBalanceDefinition failover(Class<?>... exceptions)
Uses fail over load balancer

Will not round robin and inherit the error handler.

Parameters:
exceptions - exception classes which we want to failover if one of them was thrown
Returns:
the builder

failover

public LoadBalanceDefinition failover(int maximumFailoverAttempts,
                                      boolean inheritErrorHandler,
                                      boolean roundRobin,
                                      Class<?>... exceptions)
Uses fail over load balancer

Parameters:
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 failover
inheritErrorHandler - whether or not to inherit error handler. If false then it will failover immediately in case of an exception
roundRobin - whether or not to use round robin (which keeps state)
exceptions - exception classes which we want to failover if one of them was thrown
Returns:
the builder

roundRobin

public LoadBalanceDefinition roundRobin()
Uses round robin load balancer

Returns:
the builder

random

public LoadBalanceDefinition random()
Uses random load balancer

Returns:
the builder

sticky

public LoadBalanceDefinition sticky(Expression correlationExpression)
Uses sticky load balancer

Parameters:
correlationExpression - the expression for correlation
Returns:
the builder

topic

public LoadBalanceDefinition topic()
Uses topic load balancer

Returns:
the builder

getLabel

public String getLabel()
Description copied from class: ProcessorDefinition
Returns a label to describe this node such as the expression if some kind of expression node

Overrides:
getLabel in class ProcessorDefinition<LoadBalanceDefinition>

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2007-2010 IONA Open Source Community. All Rights Reserved.