8.3.1 Netflix Ribbon Support
Using the CLI If you are creating your project using the Micronaut CLI, supply the
|
Netflix Ribbon is a inter-process communication library used at Netflix that has support for customizable load balancing strategies.
If you need more flexibility in how your application performs client-side load balancing then you may wish use Micronaut’s Netflix Ribbon support.
To add Ribbon support to your application add the netflix-ribbon
configuration to build.gradle
or pom.xml
:
build.gradle
compile "io.micronaut.netflix:micronaut-netflix-ribbon"
The LoadBalancer implementations will now be RibbonLoadBalancer instances.
Ribbon’s Configuration options can be set using the ribbon
namespace in configuration. For example in application.yml
:
Configuring Ribbon
ribbon:
VipAddress: test
ServerListRefreshInterval: 2000
Each discovered client can also be configured under ribbon.clients
. For example given a @Client(id = "hello-world")
you can configure Ribbon settings with:
Per Client Ribbon Settings
ribbon:
clients:
hello-world:
VipAddress: test
ServerListRefreshInterval: 2000
By default Micronaut registers a DiscoveryClientServerList for each client that integrates Ribbon with Micronaut’s DiscoveryClient.