Package org.kiwiproject.registry.client
Interface RegistryClient
-
- All Known Implementing Classes:
ConsulRegistryClient
,EurekaRegistryClient
public interface RegistryClient
Base of all registry client implementations in order to find running services
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
RegistryClient.InstanceQuery
Encapsulates search parameters for finding service instances
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default List<ServiceInstance>
findAllServiceInstancesBy(String serviceName)
Attempts to find all service instances with the given service name.List<ServiceInstance>
findAllServiceInstancesBy(RegistryClient.InstanceQuery query)
Attempts to find all service instances from the givenRegistryClient.InstanceQuery
.default Optional<ServiceInstance>
findServiceInstanceBy(String serviceName)
Attempts to find a service instance with the given service name.Optional<ServiceInstance>
findServiceInstanceBy(String serviceName, String instanceId)
Attempts to find a service instance with the given service name and the given instance id.default Optional<ServiceInstance>
findServiceInstanceBy(RegistryClient.InstanceQuery query)
Attempts to find a service instance from the givenRegistryClient.InstanceQuery
.List<ServiceInstance>
retrieveAllRegisteredInstances()
Retrieves all registered service instances from the registry.
-
-
-
Method Detail
-
findServiceInstanceBy
default Optional<ServiceInstance> findServiceInstanceBy(String serviceName)
Attempts to find a service instance with the given service name.If there are more than one instance, the implementation should decide the order in which the service is returned (e.g. round-robin, random, LIFO, FIFO, etc.)
- Parameters:
serviceName
- The name of the service that is being requested- Returns:
- an
Optional
containing the found service orOptional.empty()
-
findServiceInstanceBy
Optional<ServiceInstance> findServiceInstanceBy(String serviceName, String instanceId)
Attempts to find a service instance with the given service name and the given instance id.- Parameters:
serviceName
- The name of the service that is being requestedinstanceId
- The id of the instance that is wanted- Returns:
- an
Optional
containing the found service orOptional.empty()
-
findServiceInstanceBy
default Optional<ServiceInstance> findServiceInstanceBy(RegistryClient.InstanceQuery query)
Attempts to find a service instance from the givenRegistryClient.InstanceQuery
.If there are more than one instance, the implementation should decide the order in which the service is returned (e.g. round-robin, random, LIFO, FIFO, etc.)
- Parameters:
query
- aRegistryClient.InstanceQuery
containing the search parameters to find the instance- Returns:
- an
Optional
containing the found service orOptional.empty()
-
findAllServiceInstancesBy
default List<ServiceInstance> findAllServiceInstancesBy(String serviceName)
Attempts to find all service instances with the given service name.- Parameters:
serviceName
- The name of the service that is being requested- Returns:
- a
List
containing the found services
-
findAllServiceInstancesBy
List<ServiceInstance> findAllServiceInstancesBy(RegistryClient.InstanceQuery query)
Attempts to find all service instances from the givenRegistryClient.InstanceQuery
.- Parameters:
query
- aRegistryClient.InstanceQuery
containing the search parameters to find the instance- Returns:
- a
List
containing the found services
-
retrieveAllRegisteredInstances
List<ServiceInstance> retrieveAllRegisteredInstances()
Retrieves all registered service instances from the registry.- Returns:
- a
List
containing all registered service instances
-
-