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

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