@@ -75,53 +75,78 @@ ObjectMapper getObjectMapper() {
75
75
}
76
76
77
77
/**
78
- * Registers a service to Consul Agent with service ID .
78
+ * Registers a service to Consul Agent.
79
79
*
80
80
* @param serviceId a service ID that identifying a service
81
81
* @param serviceName a service name to register
82
82
* @param endpoint an endpoint of service to register
83
83
* @param check a check for the service
84
84
* @param tags tags for the service
85
- * @return a {@link CompletableFuture} that will be completed with the registered service ID
85
+ *
86
+ * @return an HttpResponse representing the HTTP response from Consul
86
87
*/
87
88
public HttpResponse register (String serviceId , String serviceName , Endpoint endpoint ,
88
89
@ Nullable Check check , List <String > tags ) {
89
90
return agentClient .register (serviceId , serviceName , endpoint .host (), endpoint .port (), check , tags );
90
91
}
91
92
92
93
/**
93
- * De-registers a service to Consul Agent.
94
+ * De-registers a service from Consul Agent.
94
95
*
95
96
* @param serviceId a service ID that identifying a service
97
+ *
98
+ * @return an HttpResponse representing the HTTP response from Consul
96
99
*/
97
100
public HttpResponse deregister (String serviceId ) {
98
101
return agentClient .deregister (serviceId );
99
102
}
100
103
101
104
/**
102
- * Get registered endpoints with service name from Consul agent.
105
+ * Retrieves the list of registered endpoints for the specified service name from the Consul agent.
106
+ *
107
+ * @param serviceName the name of the service whose endpoints are to be retrieved
108
+ *
109
+ * @return a {@link CompletableFuture} which provides a list of {@link Endpoint}s
103
110
*/
104
111
public CompletableFuture <List <Endpoint >> endpoints (String serviceName ) {
105
112
return endpoints (serviceName , null , null );
106
113
}
107
114
108
115
/**
109
- * Get registered endpoints with service name in datacenter from Consul agent.
116
+ * Retrieves the list of registered endpoints for the specified service name and datacenter
117
+ * from the Consul agent, optionally applying a filter.
118
+ *
119
+ * @param serviceName the name of the service whose endpoints are to be retrieved
120
+ * @param datacenter the datacenter to query; if {@code null}, the default datacenter is used
121
+ * @param filter a filter expression to apply; if {@code null}, no filtering is performed
122
+ *
123
+ * @return a {@link CompletableFuture} which provides a list of {@link Endpoint}s
110
124
*/
111
125
public CompletableFuture <List <Endpoint >> endpoints (String serviceName , @ Nullable String datacenter ,
112
126
@ Nullable String filter ) {
113
127
return catalogClient .endpoints (serviceName , datacenter , filter );
114
128
}
115
129
116
130
/**
117
- * Returns the registered endpoints with the specified service name from Consul agent.
131
+ * Retrieves the list of healthy endpoints for the specified service name from the Consul agent.
132
+ *
133
+ * @param serviceName the name of the service whose healthy endpoints are to be retrieved
134
+ *
135
+ * @return a {@link CompletableFuture} which provides a list of healthy {@link Endpoint}s
118
136
*/
119
137
public CompletableFuture <List <Endpoint >> healthyEndpoints (String serviceName ) {
120
138
return healthyEndpoints (serviceName , null , null );
121
139
}
122
140
123
141
/**
124
- * Returns the registered endpoints with the specified service name in datacenter from Consul agent.
142
+ * Retrieves the list of healthy endpoints for the specified service name and datacenter
143
+ * from the Consul agent, optionally applying a filter.
144
+ *
145
+ * @param serviceName the name of the service whose healthy endpoints are to be retrieved
146
+ * @param datacenter the datacenter to query; if {@code null}, the default datacenter is used
147
+ * @param filter a filter expression to apply; if {@code null}, no filtering is performed
148
+ *
149
+ * @return a {@link CompletableFuture} which provides a list of healthy {@link Endpoint}s
125
150
*/
126
151
public CompletableFuture <List <Endpoint >> healthyEndpoints (String serviceName , @ Nullable String datacenter ,
127
152
@ Nullable String filter ) {
0 commit comments