Add flexibility to zone preference in load balancing (#1174)

This commit is contained in:
Benoit Kessler
2022-12-13 02:03:18 +11:00
committed by Olga Maciaszek-Sharma
parent 987704784f
commit c13c8bbb5b

View File

@@ -198,6 +198,21 @@ public final class ServiceInstanceListSupplierBuilder {
return this;
}
/**
* Adds a {@link ZonePreferenceServiceInstanceListSupplier} to the
* {@link ServiceInstanceListSupplier} hierarchy.
* @param zoneName desired zone for zone preference
* @return the {@link ServiceInstanceListSupplierBuilder} object
*/
public ServiceInstanceListSupplierBuilder withZonePreference(String zoneName) {
DelegateCreator creator = (context, delegate) -> {
LoadBalancerZoneConfig zoneConfig = new LoadBalancerZoneConfig(zoneName);
return new ZonePreferenceServiceInstanceListSupplier(delegate, zoneConfig);
};
this.creators.add(creator);
return this;
}
/**
* Adds a {@link RequestBasedStickySessionServiceInstanceListSupplier} to the
* {@link ServiceInstanceListSupplier} hierarchy.