Package com.networknt.consul.client
Interface ConsulClient
-
- All Known Implementing Classes:
ConsulClientImpl
public interface ConsulClient
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcheckFail(String serviceId, String token)Set specific serviceId status as failvoidcheckPass(String serviceId, String token)Set specific serviceId status as passConsulResponse<List<ConsulService>>lookupHealthService(String serviceName, String tag, long lastConsulIndex, String token)get latest service list with a tag filter and a security token to lookup health services based on serviceName, if lastConsulIndex == 0, will get result right away.voidregisterService(ConsulService service, String token)register a consul servicevoidunregisterService(String serviceid, String token)unregister a consul service
-
-
-
Method Detail
-
checkPass
void checkPass(String serviceId, String token)
Set specific serviceId status as pass- Parameters:
serviceId- service idtoken- ACL token for consul
-
checkFail
void checkFail(String serviceId, String token)
Set specific serviceId status as fail- Parameters:
serviceId- service idtoken- ACL token for consul
-
registerService
void registerService(ConsulService service, String token)
register a consul service- Parameters:
service- service objecttoken- ACL token for consul
-
unregisterService
void unregisterService(String serviceid, String token)
unregister a consul service- Parameters:
serviceid- service idtoken- ACL token for consul
-
lookupHealthService
ConsulResponse<List<ConsulService>> lookupHealthService(String serviceName, String tag, long lastConsulIndex, String token)
get latest service list with a tag filter and a security token to lookup health services based on serviceName, if lastConsulIndex == 0, will get result right away. if lastConsulIndex != 0, will establish a long query with Consul.- Parameters:
serviceName- service name (service_id)tag- tag that is used for filtering (env_tag)lastConsulIndex- last consul indextoken- Consul token for security (Consul ACL)- Returns:
- if Consul connection fails: - newResponse is null if Consul connection successful: - newResponse is non-null, and - newResponse.getValue() != null, and - newResponse.getValue().size() == number of IPs registered for serviceName in Consul
-
-