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 GitHub
parent f26c2b3e93
commit 9849d9b23d

View File

@@ -224,6 +224,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.