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

The problem of multiple keys in ConfigWatch

Open
#416 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hi,
I'm using consul config in a spring application, but I found a problem in the ConfigWatch.
I have two keys to watch. One is config/application/data which is for the common configuration, the ohter is config/appName/data which is for the private configuraion.
I hope that one of them is updated in consul, I need to kown the notification from consul. However, If config/application/data is blocked in the ConfigWatch and config/appName/data is updated now, the Spring application can't get any notification from consul. Because config keys are not blocked in the same time, they do watch action one by one. Therefore one key is blocked in watch, the other will not get any notification even if it has been updated.

for (String context : this.consulIndexes.keySet()) {
...
    Response<List<GetValue>> response = this.consul.getKVValues(context, aclToken,
        new QueryParams(this.properties.getWatch().getWaitTime(),
            currentIndex));
...
}

So, how can I do to solve this problem?

Thanks.

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 at ConfigWatch, especially the loop over consulIndexes and its getKVValues calls with QueryParams. Reproduce the case with separate common and application keys, then verify that an update to either key produces a notification even while another watch is blocked.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.