I'm working in implementing gRPC with Spring Cloud Consul. I'm using the yidongnan/grpc-spring-boot-starter.
The current implementation of ConsulCatalogWatch use the consul api method getCatalogServices() that internally goes to /v1/catalog/services. This endpoint doesn't filter the services in passing state.
I noticed that when the service is just registered in Consul it takes a few moments to get to the passing state, the problem here is that ConsulCatalogWatch sends the HeartbeatEvent with a new consulIndex when a new service is registered in Consul, but there is no new consulIndex when this new service changes its status to passing.
This is a problem with gRPC because the connections to the gRPC servers are permanent and the list of servers needs to be updated when a new gRPC server gets the passing state in Consul.
I created my own implementation of a new Watch that uses the consul api method getHealthChecksState() that internally goes to /v1/health/state/passing. In this endpoint the consulIndex changes every time the status of a service changes. With this the list of gRPC servers is updated when the status of a service changes in Consul.
I already have a custom solution for my project but I think that having this in the framework might be useful for others.
I'm working in implementing gRPC with Spring Cloud Consul. I'm using the yidongnan/grpc-spring-boot-starter. The current implementation of ConsulCatalogWatch use the consul api method getCatalogServices() that internally goes to /v1/catalog/services. This endpoint doesn't filter the services in passing state. I noticed that when the service is just registered in Consul it takes a few moments to get to the passing state, the problem here is that ConsulCatalogWatch sends the HeartbeatEvent with a new consulIndex when a new service is registered in Consul, but there is no new consulIndex when this new service changes its status to passing.
This is a problem with gRPC because the connections to the gRPC servers are permanent and the list of servers needs to be updated when a new gRPC server gets the passing state in Consul.
I created my own implementation of a new Watch that uses the consul api method getHealthChecksState() that internally goes to /v1/health/state/passing. In this endpoint the consulIndex changes every time the status of a service changes. With this the list of gRPC servers is updated when the status of a service changes in Consul. I already have a custom solution for my project but I think that having this in the framework might be useful for others.