spring-cloud / spring-cloud/spring-cloud-consul

Create an alternative Catalog Watch when spring.cloud.consul.discovery.query-passing=true

Open
#489 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted
Dominant language
Java
Stars
822
Forks
539
Avg merge
9h 31m
Merged PRs (30d)
7

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading ConsulCatalogWatch and the handling of spring.cloud.consul.discovery.query-passing=true. Compare the getCatalogServices() and getHealthChecksState() paths, then inspect existing watch tests if available. Done means service changes to passing state produce the required HeartbeatEvent and update gRPC service discovery.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
distributed-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.