Class ConsulRegistryClient
- java.lang.Object
-
- org.kiwiproject.registry.consul.client.ConsulRegistryClient
-
- All Implemented Interfaces:
RegistryClient
public class ConsulRegistryClient extends Object implements RegistryClient
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.kiwiproject.registry.client.RegistryClient
RegistryClient.InstanceQuery
-
-
Constructor Summary
Constructors Constructor Description ConsulRegistryClient(com.orbitz.consul.Consul consul, ConsulConfig config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<ServiceInstance>findAllServiceInstancesBy(RegistryClient.InstanceQuery query)Attempts to find all service instances from the givenRegistryClient.InstanceQuery.Optional<ServiceInstance>findServiceInstanceBy(String serviceName, String instanceId)Attempts to find a service instance with the given service name and the given instance id.List<ServiceInstance>retrieveAllRegisteredInstances()Returns all registered services in Consul.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.kiwiproject.registry.client.RegistryClient
findAllServiceInstancesBy, findServiceInstanceBy, findServiceInstanceBy
-
-
-
-
Constructor Detail
-
ConsulRegistryClient
public ConsulRegistryClient(com.orbitz.consul.Consul consul, ConsulConfig config)
-
-
Method Detail
-
findServiceInstanceBy
public Optional<ServiceInstance> findServiceInstanceBy(String serviceName, String instanceId)
Description copied from interface:RegistryClientAttempts to find a service instance with the given service name and the given instance id.- Specified by:
findServiceInstanceByin interfaceRegistryClient- Parameters:
serviceName- The name of the service that is being requestedinstanceId- The id of the instance that is wanted- Returns:
- an
Optionalcontaining the found service orOptional.empty()
-
findAllServiceInstancesBy
public List<ServiceInstance> findAllServiceInstancesBy(RegistryClient.InstanceQuery query)
Description copied from interface:RegistryClientAttempts to find all service instances from the givenRegistryClient.InstanceQuery.- Specified by:
findAllServiceInstancesByin interfaceRegistryClient- Parameters:
query- aRegistryClient.InstanceQuerycontaining the search parameters to find the instance- Returns:
- a
Listcontaining the found services
-
retrieveAllRegisteredInstances
public List<ServiceInstance> retrieveAllRegisteredInstances()
Returns all registered services in Consul.- Specified by:
retrieveAllRegisteredInstancesin interfaceRegistryClient- Returns:
- a
Listcontaining all registered service instances - Implementation Note:
- This will return ALL services in Consul (including Consul itself) and attempt to map it into a
ServiceInstanceobject
-
-