Sticky EIP

Sticky Load Balancer. Sticky load balancing uses an Expression to calculate a correlation key to perform the sticky load balancing.

Options

The Sticky EIP supports 1 options which are listed below:

Name Description Default Type

correlationExpression

Required The correlation expression to use to calculate the correlation key

NamespaceAware Expression

Examples

In this case we are using the header test as correlation expression:

from("direct:start")
    .loadBalance()
    .sticky(header("test"))
    .to("seda:x", "seda:y", "seda:z");

In XML you’ll have a route like this

<from uri="direct:start"/>
    <loadBalance>
       <sticky>
           <correlationExpression>
               <header>test</header>
           </correlationExpression>
       </sticky>
       <to uri="seda:x"/>
       <to uri="seda:y"/>
       <to uri="seda:z"/>
    </loadBalance>