public static class Consultant.Builder extends Object
| Modifier and Type | Method and Description |
|---|---|
Consultant |
build()
Builds a new instance of the Consultant class using the specified arguments.
|
Consultant.Builder |
identifyAs(String serviceName)
States the identify of this application.
|
Consultant.Builder |
identifyAs(String serviceName,
String datacenter)
States the identify of this application.
|
Consultant.Builder |
identifyAs(String serviceName,
String datacenter,
String hostname)
States the identify of this application.
|
Consultant.Builder |
identifyAs(String serviceName,
String datacenter,
String hostname,
String instanceName)
States the identify of this application.
|
Consultant.Builder |
onSettingUpdate(String key,
SettingListener listener)
Specifies a callback listener which is notified of whenever the specified setting is updated.
|
Consultant.Builder |
onValidConfig(ConfigListener listener)
Specifies a callback listener which is notified of whenever a new and valid configuration is detected
in Consul.
|
Consultant.Builder |
usingExecutor(ScheduledExecutorService executor)
States that Consultant should use a specific executor service for listening to configuration updates.
|
Consultant.Builder |
validateConfigWith(ConfigValidator validator)
Specifies the validator which is used to determine if a new configuration detected in Consul is valid,
and may be published through the ConfigListener callback.
|
Consultant.Builder |
withConsulHost(String host)
Specifies where the Consul REST API can be reached on.
|
public Consultant.Builder usingExecutor(ScheduledExecutorService executor)
executor - The ScheduledExecutorService to use to schedule jobs on.public Consultant.Builder withConsulHost(String host)
CONSUL_HOST=http://localhost.host - The host where the Consul REST API can be found.public Consultant.Builder identifyAs(String serviceName)
SERVICE_NAME, and optionally SERVICE_DC and
SERVICE_HOST.serviceName - The name of this service.public Consultant.Builder identifyAs(String serviceName, String datacenter)
SERVICE_NAME, and optionally SERVICE_DC and
SERVICE_HOST.serviceName - The name of this service.datacenter - The name of the datacenter where this service is running in.public Consultant.Builder identifyAs(String serviceName, String datacenter, String hostname)
SERVICE_NAME, and optionally SERVICE_DC and
SERVICE_HOST.serviceName - The name of this service.datacenter - The name of the datacenter where this service is running in.hostname - The name of the host where this service is running on.public Consultant.Builder identifyAs(String serviceName, String datacenter, String hostname, String instanceName)
SERVICE_NAME, and optionally SERVICE_DC,
SERVICE_HOST, and SERVICE_INSTANCE.serviceName - The name of this service.datacenter - The name of the datacenter where this service is running in.hostname - The name of the host where this service is running on.instanceName - The name/role of this service instance.public Consultant.Builder onValidConfig(ConfigListener listener)
listener - The listener to call when a new valid configuration is detected.public Consultant.Builder onSettingUpdate(String key, SettingListener listener)
listener - The listener to call when the specified setting is updated.public Consultant.Builder validateConfigWith(ConfigValidator validator)
validator - The validator to call when a new configuration is detected.public Consultant build()
Copyright © 2015. All rights reserved.