Package org.kiwiproject.registry.client
Class MultiRegistryClient
java.lang.Object
org.kiwiproject.registry.client.MultiRegistryClient
- All Implemented Interfaces:
RegistryClient
A
RegistryClient that finds services in more than one registry.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.kiwiproject.registry.client.RegistryClient
RegistryClient.InstanceQuery -
Constructor Summary
ConstructorsConstructorDescriptionMultiRegistryClient(List<RegistryClient> registryClients) Construct a new instance with the specfiedRegistryClients to use when performing service lookups. -
Method Summary
Modifier and TypeMethodDescriptionAttempts to find all service instances from the givenRegistryClient.InstanceQuery.findServiceInstanceBy(String serviceName, String instanceId) Attempts to find a service instance with the given service name and the given instance id.static MultiRegistryClientof(RegistryClient... registryClients) Factory method to create a new instance from the givenRegistryClients.Retrieves all registered service instances from the registry.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.kiwiproject.registry.client.RegistryClient
findAllServiceInstancesBy, findServiceInstanceBy, findServiceInstanceBy
-
Constructor Details
-
MultiRegistryClient
Construct a new instance with the specfiedRegistryClients to use when performing service lookups. The order in the provided list is the order in which the service lookups will occur.- Parameters:
registryClients- a list ofRegistryClientinstances to use; must have at least one RegistryClient
-
-
Method Details
-
of
Factory method to create a new instance from the givenRegistryClients.- Parameters:
registryClients- theRegistryClientinstances to use; must have at least one RegistryClient- Returns:
- a new MultiRegistryClient instance
-
findServiceInstanceBy
Attempts to find a service instance with the given service name and the given instance id.Returns the first
ServiceInstanceit finds, checking eachRegistryClientin order.- 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
Attempts to find all service instances from the givenRegistryClient.InstanceQuery.Returns all services that match the query from all
RegistryClients that return any results, checking eachRegistryClientin order.- Specified by:
findAllServiceInstancesByin interfaceRegistryClient- Parameters:
query- aRegistryClient.InstanceQuerycontaining the search parameters to find the instance- Returns:
- a
Listcontaining the found services
-
retrieveAllRegisteredInstances
Retrieves all registered service instances from the registry.Returns all registered services from all
RegistryClients that return any results, checking eachRegistryClientin order.- Specified by:
retrieveAllRegisteredInstancesin interfaceRegistryClient- Returns:
- a
Listcontaining all registered service instances
-