io.smallrye.stork.loadbalancer.requests.LeastRequestsLoadBalancerProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of stork-load-balancer-least-requests Show documentation
Show all versions of stork-load-balancer-least-requests Show documentation
SmallRye Stork Load Balancer provider picking the instance with the least inflight requests
package io.smallrye.stork.loadbalancer.requests;
import jakarta.enterprise.context.ApplicationScoped;
import io.smallrye.stork.api.LoadBalancer;
import io.smallrye.stork.api.ServiceDiscovery;
import io.smallrye.stork.api.config.LoadBalancerType;
import io.smallrye.stork.spi.LoadBalancerProvider;
/**
* A load balancer provider that picks the instance with the less inflight requests.
*/
@LoadBalancerType("least-requests")
@ApplicationScoped
public class LeastRequestsLoadBalancerProvider
implements LoadBalancerProvider {
@Override
public LoadBalancer createLoadBalancer(LeastRequestsConfiguration config,
ServiceDiscovery serviceDiscovery) {
return new LeastRequestsLoadBalancer();
}
}