Skip to content

Commit

Permalink
Update javadoc in ConsulClient.java
Browse files Browse the repository at this point in the history
  • Loading branch information
kth496 committed Feb 6, 2025
1 parent 760b43a commit 8af9c9a
Showing 1 changed file with 26 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,53 +75,72 @@ ObjectMapper getObjectMapper() {
}

/**
* Registers a service to Consul Agent with service ID.
* Registers a service to Consul Agent
*
* @param serviceId a service ID that identifying a service
* @param serviceName a service name to register
* @param endpoint an endpoint of service to register
* @param check a check for the service
* @param tags tags for the service
* @return a {@link CompletableFuture} that will be completed with the registered service ID
* @return an HttpResponse representing the HTTP response from Consul
*/
public HttpResponse register(String serviceId, String serviceName, Endpoint endpoint,
@Nullable Check check, List<String> tags) {
return agentClient.register(serviceId, serviceName, endpoint.host(), endpoint.port(), check, tags);
}

/**
* De-registers a service to Consul Agent.
* De-registers a service from Consul Agent
*
* @param serviceId a service ID that identifying a service
* @return an HttpResponse representing the HTTP response from Consul
*/
public HttpResponse deregister(String serviceId) {
return agentClient.deregister(serviceId);
}

/**
* Get registered endpoints with service name from Consul agent.
* Retrieves the list of registered endpoints for the specified service name from the Consul agent.
*
* @param serviceName the name of the service whose endpoints are to be retrieved
* @return a {@link CompletableFuture} which provides a list of {@link Endpoint}s
*/
public CompletableFuture<List<Endpoint>> endpoints(String serviceName) {
return endpoints(serviceName, null, null);
}

/**
* Get registered endpoints with service name in datacenter from Consul agent.
* Retrieves the list of registered endpoints for the specified service name and datacenter from the Consul agent,
* optionally applying a filter.
*
* @param serviceName the name of the service whose endpoints are to be retrieved
* @param datacenter the datacenter to query; if {@code null}, the default datacenter is used
* @param filter a filter expression to apply; if {@code null}, no filtering is performed
* @return a {@link CompletableFuture} which provides a list of {@link Endpoint}s
*/
public CompletableFuture<List<Endpoint>> endpoints(String serviceName, @Nullable String datacenter,
@Nullable String filter) {
return catalogClient.endpoints(serviceName, datacenter, filter);
}

/**
* Returns the registered endpoints with the specified service name from Consul agent.
* Retrieves the list of healthy endpoints for the specified service name from the Consul agent.
*
* @param serviceName the name of the service whose healthy endpoints are to be retrieved
* @return a {@link CompletableFuture} which provides a list of healthy {@link Endpoint}s
*/
public CompletableFuture<List<Endpoint>> healthyEndpoints(String serviceName) {
return healthyEndpoints(serviceName, null, null);
}

/**
* Returns the registered endpoints with the specified service name in datacenter from Consul agent.
* Retrieves the list of healthy endpoints for the specified service name and datacenter from the Consul agent,
* optionally applying a filter.
*
* @param serviceName the name of the service whose healthy endpoints are to be retrieved
* @param datacenter the datacenter to query; if {@code null}, the default datacenter is used
* @param filter a filter expression to apply; if {@code null}, no filtering is performed
* @return a {@link CompletableFuture} which provides a list of healthy {@link Endpoint}s
*/
public CompletableFuture<List<Endpoint>> healthyEndpoints(String serviceName, @Nullable String datacenter,
@Nullable String filter) {
Expand Down

0 comments on commit 8af9c9a

Please sign in to comment.