Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Option

Type

Default

Description

roundRobin

boolean

false

The default value for round-robin is false. In the absence of this setting or parameter the load balancing algorithm used is random.

distributionRatio

String

none

The distributionRatio is a delimited String consisting on integer weights separated by delimiters for example "2:,3:,5". The distributionRatio must match the number of endpoints and/or processors specified in the load balancer list.

distributionRatioDelimiter

String

: ,

The distributionRatioDelimiter is the delimiter used to specify the distributionRatio. If this attribute is not specified a default delimiter ":," is expected as the delimiter used for specifying the distributionRatio.

...

Code Block
java
java
// round-robin
from("direct:start")
    .loadBalance().weighted(true, "4:2:1" distributionRatioDelimiter=":")
    .to("mock:x", "mock:y", "mock:z");

//random
from("direct:start")
    .loadBalance().weighted(false, "4,2,1", ",")
    .to("mock:x", "mock:y", "mock:z");

...

Code Block
xml
xml
    <route>
      <from uri="direct:start"/>
      <loadBalance>
        <weighted roundRobin="false" distributionRatio="4,-2,-1" distributionRatioDelimiter=",-" />
          <to uri="mock:x"/>
          <to uri="mock:y"/>
          <to uri="mock:z"/>
      </loadBalance>
    </route>

...