spring-cloud / spring-cloud/spring-cloud-commons

FR: Return the combination of ServiceInstances in CompositeDiscoveryClients

Open
#1,190 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
751
Forks
744
Avg merge
1d 14h
Merged PRs (30d)
9

Description

Currently the ReactiveCompositeDiscoveryClient returns the first non-empty Flux of ServiceInstances when invoking its getInstances() method.
When you use multiple DiscoveryClients and you want to balance traffic over them (e.g. a weighted load balancing strategy towards multiple cloud environments), you will have to disable the spring.cloud.discovery.reactive.enabled and provide your own implementation that replaces the existing ReactiveCompositeDiscoveryClient. Disabling this property also has some impact on other conditionals, such as in KubernetesInformerReactiveDiscoveryClientAutoConfiguration for example

This is manageable, but it feels like returning combined results of DiscoveryClients instead of returning the first non empty flux would often make more sense.

Would it be possible to add a property to switch the behaviour of the ReactiveCompositeDiscoveryClient so that results from DiscoveryClients are combined? (and perhaps also for the non reactive variant CompositeDiscoveryClient)

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 ReactiveCompositeDiscoveryClient.java and compare its getInstances() behavior with CompositeDiscoveryClient.java. Trace how discovery clients are configured and identify the existing reactive enablement conditionals, including KubernetesInformerReactiveDiscoveryClientAutoConfiguration. Done means the requested configurable combined-results behavior is specified and covered for the relevant client variants.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend, distributed-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.