public interface ServiceDiscovery<T> extends Closeable
Modifier and Type | Method and Description |
---|---|
ServiceInstance<T> |
queryForInstance(String name,
String id)
Return a service instance POJO
|
Collection<ServiceInstance<T>> |
queryForInstances(String name)
Return all known instances for the given service
|
Collection<String> |
queryForNames()
Return the names of all known services
|
void |
registerService(ServiceInstance<T> service)
Register/re-register a service
|
ServiceCacheBuilder<T> |
serviceCacheBuilder()
Allocate a new service cache builder.
|
ServiceProviderBuilder<T> |
serviceProviderBuilder()
Allocate a new builder.
|
void |
start()
The discovery must be started before use
|
void |
unregisterService(ServiceInstance<T> service)
Unregister/remove a service instance
|
void |
updateService(ServiceInstance<T> service)
Update a service
|
void start() throws Exception
Exception
- errorsvoid registerService(ServiceInstance<T> service) throws Exception
service
- service to addException
- errorsvoid updateService(ServiceInstance<T> service) throws Exception
service
- service to updateException
- errorsvoid unregisterService(ServiceInstance<T> service) throws Exception
service
- the serviceException
- errorsServiceCacheBuilder<T> serviceCacheBuilder()
Collection<String> queryForNames() throws Exception
Exception
- errorsCollection<ServiceInstance<T>> queryForInstances(String name) throws Exception
name
- name of the serviceException
- errorsServiceInstance<T> queryForInstance(String name, String id) throws Exception
name
- name of the serviceid
- ID of the instancenull
if not foundException
- errorsServiceProviderBuilder<T> serviceProviderBuilder()
ServiceProviderBuilder.providerStrategy(org.apache.curator.x.discovery.ProviderStrategy<T>)
is set to RoundRobinStrategy
Copyright © 2011–2023 The Apache Software Foundation. All rights reserved.