Package io.vertx.servicediscovery
Class ServiceDiscoveryOptions
- java.lang.Object
-
- io.vertx.servicediscovery.ServiceDiscoveryOptions
-
public class ServiceDiscoveryOptions extends Object
Options to configure the service discovery.- Author:
- Clement Escoffier
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_ANNOUNCE_ADDRESS
static String
DEFAULT_USAGE_ADDRESS
-
Constructor Summary
Constructors Constructor Description ServiceDiscoveryOptions()
Creates a new instance ofServiceDiscoveryOptions
using the default values.ServiceDiscoveryOptions(JsonObject json)
Creates a new instance ofServiceDiscoveryOptions
from its JSON representation.ServiceDiscoveryOptions(ServiceDiscoveryOptions other)
Creates a new instance ofServiceDiscoveryOptions
by copying the values from another instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getAnnounceAddress()
JsonObject
getBackendConfiguration()
String
getName()
Gets the service discovery name used in service usage events.String
getUsageAddress()
ServiceDiscoveryOptions
setAnnounceAddress(String announceAddress)
Sets the event bus address on which the service arrivals, departures and modifications are announced.ServiceDiscoveryOptions
setBackendConfiguration(JsonObject backendConfiguration)
Sets the configuration passed to theServiceDiscoveryBackend
.ServiceDiscoveryOptions
setName(String name)
Sets the service discovery name used in the service usage events.ServiceDiscoveryOptions
setUsageAddress(String usageAddress)
Sets the usage address: the event bus address on which are sent the service usage events (bind / release).JsonObject
toJson()
Builds the JSON representation for the currentServiceDiscoveryOptions
.
-
-
-
Field Detail
-
DEFAULT_ANNOUNCE_ADDRESS
public static final String DEFAULT_ANNOUNCE_ADDRESS
- See Also:
- Constant Field Values
-
DEFAULT_USAGE_ADDRESS
public static final String DEFAULT_USAGE_ADDRESS
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ServiceDiscoveryOptions
public ServiceDiscoveryOptions()
Creates a new instance ofServiceDiscoveryOptions
using the default values.
-
ServiceDiscoveryOptions
public ServiceDiscoveryOptions(ServiceDiscoveryOptions other)
Creates a new instance ofServiceDiscoveryOptions
by copying the values from another instance.- Parameters:
other
- the instance to copy
-
ServiceDiscoveryOptions
public ServiceDiscoveryOptions(JsonObject json)
Creates a new instance ofServiceDiscoveryOptions
from its JSON representation.- Parameters:
json
- the json object
-
-
Method Detail
-
toJson
public JsonObject toJson()
Builds the JSON representation for the currentServiceDiscoveryOptions
.- Returns:
- the json representation
-
getAnnounceAddress
public String getAnnounceAddress()
- Returns:
- the event bus address on which the service arrivals, departures and modifications are announced. This address must be consistent in the whole application.
-
setAnnounceAddress
public ServiceDiscoveryOptions setAnnounceAddress(String announceAddress)
Sets the event bus address on which the service arrivals, departures and modifications are announced. This address must be consistent in the whole application.- Parameters:
announceAddress
- the address, must not benull
- Returns:
- the current
ServiceDiscoveryOptions
-
getBackendConfiguration
public JsonObject getBackendConfiguration()
- Returns:
- the backend configuration. Cannot be
null
.
-
setBackendConfiguration
public ServiceDiscoveryOptions setBackendConfiguration(JsonObject backendConfiguration)
Sets the configuration passed to theServiceDiscoveryBackend
. Refer to the backend documentation to get more details on the requirements. The default backend does not need any configuration.- Parameters:
backendConfiguration
- the backend configuration- Returns:
- the current
ServiceDiscoveryOptions
-
setName
public ServiceDiscoveryOptions setName(String name)
Sets the service discovery name used in the service usage events. If not set, the node id is used.- Parameters:
name
- the name to use.- Returns:
- the current
ServiceDiscoveryOptions
-
getName
public String getName()
Gets the service discovery name used in service usage events. If not set the node id is used.- Returns:
- the name
-
getUsageAddress
public String getUsageAddress()
- Returns:
- the event bus address on which are sent the service usage events (bind / release).
-
setUsageAddress
public ServiceDiscoveryOptions setUsageAddress(String usageAddress)
Sets the usage address: the event bus address on which are sent the service usage events (bind / release).- Parameters:
usageAddress
- the address, {@link null} to disable use service usage tracking- Returns:
- the current
ServiceDiscoveryOptions
-
-