public class Discovery
extends java.lang.Object
'maxTimeMillis' defaults to 5000L
'maxResults' defaults tp 10
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_DISCOVERY_MAX_RESULTS |
static long |
DEFAULT_DISCOVERY_MAX_TIME_MILLIS |
| Constructor and Description |
|---|
Discovery(Connection conn)
Construct a Discovery instance with a connection and default maxTimeMillis / maxResults
|
Discovery(Connection conn,
long maxTimeMillis,
int maxResults)
Construct a Discovery instance
|
| Modifier and Type | Method and Description |
|---|---|
java.util.List<InfoResponse> |
info()
Make an info request to all services running on the server.
|
java.util.List<InfoResponse> |
info(java.lang.String serviceName)
Make an info request only to services having the matching service name
|
InfoResponse |
info(java.lang.String serviceName,
java.lang.String serviceId)
Make an info request to a specific instance of a service having matching service name and id
|
java.util.List<PingResponse> |
ping()
Make a ping request to all services running on the server.
|
java.util.List<PingResponse> |
ping(java.lang.String serviceName)
Make a ping request only to services having the matching service name
|
PingResponse |
ping(java.lang.String serviceName,
java.lang.String serviceId)
Make a ping request to a specific instance of a service having matching service name and id
|
void |
setInboxSupplier(java.util.function.Supplier<java.lang.String> inboxSupplier)
Override the normal inbox with a custom inbox to support you security model
|
java.util.List<StatsResponse> |
stats()
Make a stats request to all services running on the server.
|
java.util.List<StatsResponse> |
stats(java.lang.String serviceName)
Make a stats request only to services having the matching service name
|
StatsResponse |
stats(java.lang.String serviceName,
java.lang.String serviceId)
Make a stats request to a specific instance of a service having matching service name and id
|
public static final long DEFAULT_DISCOVERY_MAX_TIME_MILLIS
public static final int DEFAULT_DISCOVERY_MAX_RESULTS
public Discovery(Connection conn)
conn - the NATS Connectionpublic Discovery(Connection conn, long maxTimeMillis, int maxResults)
conn - the NATS ConnectionmaxTimeMillis - the maximum time to wait for discovery requests to complete or any number less than 1 to use the defaultmaxResults - the maximum number of results to wait for or any number less than 1 to use the defaultpublic void setInboxSupplier(java.util.function.Supplier<java.lang.String> inboxSupplier)
inboxSupplier - the supplierpublic java.util.List<PingResponse> ping()
PingResponsepublic java.util.List<PingResponse> ping(java.lang.String serviceName)
serviceName - the service namePingResponsepublic PingResponse ping(java.lang.String serviceName, java.lang.String serviceId)
serviceName - the service nameserviceId - the specific service idPingResponsepublic java.util.List<InfoResponse> info()
InfoResponsepublic java.util.List<InfoResponse> info(java.lang.String serviceName)
serviceName - the service nameInfoResponsepublic InfoResponse info(java.lang.String serviceName, java.lang.String serviceId)
serviceName - the service nameserviceId - the specific service idInfoResponsepublic java.util.List<StatsResponse> stats()
StatsResponsepublic java.util.List<StatsResponse> stats(java.lang.String serviceName)
serviceName - the service nameStatsResponsepublic StatsResponse stats(java.lang.String serviceName, java.lang.String serviceId)
serviceName - the service nameserviceId - the specific service idStatsResponse