Load balancing across a number of endpoints

When you need the ability to distribute a sequence of messages between a predefined set of endpoints, the Load Balancer EIP is a good choice. This is useful for tasks such as web service load balancing at the application level, when a hardware load balancer is not available for use. This EIP allows you to plug in a number of strategies to define how the messages should be distributed amongst the endpoints.

This recipe will show you how to load balance (route) a message across a set of endpoints using a specified policy (for example, round robin).

Getting ready

The Java code for this recipe is located in the org.camelcookbook.routing.loadbalancer package. The Spring XML files are located under src/main/resources/META-INF/spring ...

Get Apache Camel Developer's Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.