Interface ServiceInstanceChooser

All Known Subinterfaces:
LoadBalancerClient

public interface ServiceInstanceChooser
Implemented by classes which use a load balancer to choose a server to send a request to.
Author:
Ryan Baxter, Olga Maciaszek-Sharma
  • Method Summary

    Modifier and Type
    Method
    Description
    choose(String serviceId)
    Chooses a ServiceInstance from the LoadBalancer for the specified service.
    choose(String serviceId, Request<T> request)
    Chooses a ServiceInstance from the LoadBalancer for the specified service and LoadBalancer request.
  • Method Details

    • choose

      ServiceInstance choose(String serviceId)
      Chooses a ServiceInstance from the LoadBalancer for the specified service.
      Parameters:
      serviceId - The service ID to look up the LoadBalancer.
      Returns:
      A ServiceInstance that matches the serviceId.
    • choose

      <T> ServiceInstance choose(String serviceId, Request<T> request)
      Chooses a ServiceInstance from the LoadBalancer for the specified service and LoadBalancer request.
      Type Parameters:
      T - The type of the request context.
      Parameters:
      serviceId - The service ID to look up the LoadBalancer.
      request - The request to pass on to the LoadBalancer
      Returns:
      A ServiceInstance that matches the serviceId.