This example demonstrates how to integrate any arbitrary load balancing logic with a
HttpClient. Load
balancing algorithms are not provided by
RxNetty, what is provided is a low level construct of
ConnectionProvider that abstracts providing connections for a
HttpClient. Higher level constructs like
Load Balancing, connection pooling, etc. can be built using these building blocks.
The code here uses a naive
HttpLoadBalancer that removes a host on any connection failure and otherwise round
robins on the set of available hosts.
This example, starts a couple emebedded HTTP servers two always sending 200 responses and one always sending 503
responses to demonstrate failure detection (not using the server that sends 503) and round-robin load balancing
(alternating between the two available hosts for the requests)