Sticky

Sticky mode for the Load Balancer EIP.

A stick mode means that a correlation key (calculated as Expression) is used to determine the destination. This allows routing all messages with the same key to the same destination.

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.

ExpressionSubElementDefinition

Examples

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

  • Java

  • XML

from("direct:start")
    .loadBalance().sticky(header("myKey"))
        .to("seda:x")
        .to("seda:y")
        .to("seda:z")
    .end();
<route>
<from uri="direct:start"/>
    <loadBalance>
       <sticky>
           <correlationExpression>
               <header>myKey</header>
           </correlationExpression>
       </sticky>
       <to uri="seda:x"/>
       <to uri="seda:y"/>
       <to uri="seda:z"/>
    </loadBalance>
</route>