spring-cloud / spring-cloud/spring-cloud-gateway

Update discovery client route definitionlocator documentation to use ReactiveDiscoveryClient

Open
#2,148 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted
Dominant language
Java
Stars
4.9k
Forks
3.5k
Avg merge
20h 57m
Merged PRs (30d)
8

Description

Describe the bug
Per https://cloud.spring.io/spring-cloud-gateway/multi/multi__configuration.html#_discoveryclient_route_definition_locator

The Gateway can be configured to create routes based on services registered with a DiscoveryClient compatible service registry.

To enable this, set spring.cloud.gateway.discovery.locator.enabled=true and make sure a DiscoveryClient implementation is on the classpath and enabled (such as Netflix Eureka, Consul or Zookeeper).

In my mvce I wrote a simple discovery client and verified that it does get created using @PostConstruct. However the getInstances() and getServices() do not appear to be called. They return empty sets but there's a System.out to indicate that they are executed but I don't see it in the console logs.

Sample
If possible, please provide a test case or sample application that reproduces
the problem. This makes it much easier for us to diagnose the problem and to verify that
we have fixed it.

2021-02-15 19:26:25.366  INFO 8128 --- [           main] com.example.demo.DemoApplication         : Starting DemoApplication using Java 12.0.2 on noriko with PID 8128 (D:\p\gateway-3\build\classes\java\main started by trajano in D:\p\gateway-3)
2021-02-15 19:26:25.369  INFO 8128 --- [           main] com.example.demo.DemoApplication         : No active profile set, falling back to default profiles: default
2021-02-15 19:26:25.963  INFO 8128 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=23403c62-4898-30f2-a4fd-d673a77696b7
Hello world
2021-02-15 19:26:26.928  INFO 8128 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [After]
2021-02-15 19:26:26.928  INFO 8128 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [Before]
2021-02-15 19:26:26.928  INFO 8128 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [Between]
2021-02-15 19:26:26.928  INFO 8128 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [Cookie]
2021-02-15 19:26:26.928  INFO 8128 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [Header]
2021-02-15 19:26:26.928  INFO 8128 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [Host]
2021-02-15 19:26:26.928  INFO 8128 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [Method]
2021-02-15 19:26:26.928  INFO 8128 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [Path]
2021-02-15 19:26:26.929  INFO 8128 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [Query]
2021-02-15 19:26:26.929  INFO 8128 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [ReadBody]
2021-02-15 19:26:26.929  INFO 8128 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [RemoteAddr]
2021-02-15 19:26:26.929  INFO 8128 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [Weight]
2021-02-15 19:26:26.929  INFO 8128 --- [           main] o.s.c.g.r.RouteDefinitionRouteLocator    : Loaded RoutePredicateFactory [CloudFoundryRouteService]
2021-02-15 19:26:27.053  INFO 8128 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 1 endpoint(s) beneath base path '/actuator'
2021-02-15 19:26:27.659  INFO 8128 --- [           main] o.s.b.web.embedded.netty.NettyWebServer  : Netty started on port 8080
2021-02-15 19:26:28.242  INFO 8128 --- [           main] com.example.demo.DemoApplication         : Started DemoApplication in 3.423 seconds (JVM running for 4.034)

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 with the linked DiscoveryClient route-definition-locator documentation section and locate its source in the repository. Update the terminology to use ReactiveDiscoveryClient, then verify that the configuration guidance and supported registry examples remain accurate.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring, spring-boot
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.