public class ServiceDiscoveryBuilder<T> extends Object
| Modifier and Type | Method and Description |
|---|---|
ServiceDiscoveryBuilder<T> |
basePath(String basePath)
Required - set the base path to store in ZK
|
ServiceDiscovery<T> |
build()
Build a new service discovery with the currently set values.
|
static <T> ServiceDiscoveryBuilder<T> |
builder(Class<T> payloadClass)
Return a new builder.
|
ServiceDiscoveryBuilder<T> |
client(org.apache.curator.framework.CuratorFramework client)
Required - set the client to use
|
ServiceDiscoveryBuilder<T> |
serializer(InstanceSerializer<T> serializer)
optional - change the serializer used (the default is
JsonInstanceSerializer |
ServiceDiscoveryBuilder<T> |
thisInstance(ServiceInstance<T> thisInstance)
Optional - instance that represents the service that is running.
|
ServiceDiscoveryBuilder<T> |
watchInstances(boolean watchInstances)
Optional - if true, watches for changes to locally registered instances
(via
thisInstance(ServiceInstance) or ServiceDiscovery.registerService(ServiceInstance)). |
public static <T> ServiceDiscoveryBuilder<T> builder(Class<T> payloadClass)
payloadClass - the class of the payload of your service instance (you can use Void
if your instances don't need a payload)public ServiceDiscovery<T> build()
JsonInstanceSerializer.public ServiceDiscoveryBuilder<T> client(org.apache.curator.framework.CuratorFramework client)
client - clientpublic ServiceDiscoveryBuilder<T> basePath(String basePath)
basePath - base pathpublic ServiceDiscoveryBuilder<T> serializer(InstanceSerializer<T> serializer)
JsonInstanceSerializerserializer - the serializerpublic ServiceDiscoveryBuilder<T> thisInstance(ServiceInstance<T> thisInstance)
thisInstance - initial instancepublic ServiceDiscoveryBuilder<T> watchInstances(boolean watchInstances)
thisInstance(ServiceInstance) or ServiceDiscovery.registerService(ServiceInstance)).
If the data for instances changes, they are reloaded.watchInstances - true to watch instancesCopyright © 2011–2016 The Apache Software Foundation. All rights reserved.