3

I use Spring Cloud Consul to discover the services I need for my application. The discovery client returns all registered instances for the requested service although I also returns failing instances.

Consul itself marks the failing instances corretly as failed (critical).

So, why does the discovery client not remove critical/failed instances? Or is where is the documentation which describes this?

Oliver
  • 3,815
  • 8
  • 35
  • 63
  • According to the code it seems to return all known instances without paying attention to the state of the checks. Actually it knows about failing checks of an instance but does not handle this. – Oliver Oct 28 '17 at 10:57

1 Answers1

9

After reading the source of Spring Cloud Consul I found out that I have to set the property spring.cloud.consul.discovery.queryPassing as follows

java -Dspring.cloud.consul.discovery.queryPassing=true ...`

The relevant source files are:

After setting this property the discovery client for Consul will return only those instance which pass all Consul health checks.

Oliver
  • 3,815
  • 8
  • 35
  • 63
  • 2
    Thank you very much! You really saved my time and nerves. I do not understand why such an important property is not described anywhere in the documentation! – Cepr0 Apr 27 '20 at 10:11