Interface ConsulClient

  • All Known Implementing Classes:
    ConsulClientImpl

    public interface ConsulClient
    • Method Detail

      • checkPass

        void checkPass​(String serviceId,
                       String token)
        Set specific serviceId status as pass
        Parameters:
        serviceId - service id
        token - ACL token for consul
      • checkFail

        void checkFail​(String serviceId,
                       String token)
        Set specific serviceId status as fail
        Parameters:
        serviceId - service id
        token - ACL token for consul
      • registerService

        void registerService​(ConsulService service,
                             String token)
        register a consul service
        Parameters:
        service - service object
        token - ACL token for consul
      • unregisterService

        void unregisterService​(String serviceid,
                               String token)
        unregister a consul service
        Parameters:
        serviceid - service id
        token - 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 index
        token - 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