Skip to content

Provide Spring gRPC DiscoveryClient integration #1675

Description

@Hyainth

Description

spring-projects/spring-grpc issue #341 requested support for resolving gRPC client targets such as discovery:///service-name through Spring Cloud DiscoveryClient.

A working prototype was implemented in spring-grpc, but Spring gRPC maintainers noted that this integration should live on the Spring Cloud side because of the dependency direction between Spring Boot, Spring gRPC and Spring Cloud:

Proposed Scope

Add a Spring Cloud module that bridges Spring Cloud service discovery with Spring gRPC by:

  • resolving discovery:///service-name targets through DiscoveryClient
  • refreshing resolved addresses when Spring Cloud publishes a HeartbeatEvent
  • preferring the gRPC_port metadata entry and falling back to the regular service instance port
  • optionally publishing spring.grpc.server.port as gRPC_port metadata through the Registration abstraction when metadata is mutable

Why This Belongs Here

The implementation depends on Spring Cloud abstractions such as:

  • DiscoveryClient
  • HeartbeatEvent
  • Registration

while the gRPC side can stay limited to Spring gRPC extension points.

Prior Art / Prototype

The current prototype and discussion live here:

Question

Would Spring Cloud Commons accept this as:

  1. a new module in this repository, or
  2. a different Spring Cloud repository / subproject?

If this repository is acceptable, I can adapt the current prototype to match Spring Cloud Commons conventions and open a PR here.

Activity

  1. Hyainth commented on Mar 31, 2026

    @Hyainth
    Author

    Given the dependency direction discussed in spring-projects/spring-grpc#341, I am wondering whether the better long-term home is a dedicated repository under the spring-cloud organization, for example spring-cloud-grpc, rather than a module inside spring-cloud-commons.

    The implementation is intentionally based on Spring Cloud abstractions (DiscoveryClient, HeartbeatEvent, Registration) and has already been validated locally against Nacos as a concrete Spring Cloud implementation.

    Would the Spring Cloud team prefer:

    1. a new module in spring-cloud-commons, or
    2. a dedicated repository such as spring-cloud-grpc under the spring-cloud organization?

    If a dedicated repository is preferred, is the expected process:

    • start from a personal repository and transfer later, or
    • wait for a maintainer-created repository under the org and then open the initial PR there?

    For context, the original request and maintainer guidance are here:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions