apollo-java icon indicating copy to clipboard operation
apollo-java copied to clipboard

add multiple appId,pull other appId config into config.

Open TerryLam2010 opened this issue 1 year ago • 10 comments

What's the purpose of this PR

add multiple appId pull into config see https://github.com/apolloconfig/apollo-java/issues/66

Which issue(s) this PR fixes:

Fixes #

Follow this checklist to help us incorporate your contribution quickly and easily:

  • [ ] add multiple appId pull into config.see https://github.com/apolloconfig/apollo-java/issues/66

Summary by CodeRabbit

  • New Features

    • Introduced appId parameter across various configuration classes, allowing configuration queries and changes to be associated with a specific application ID.
    • Added new method getAccessKeySecret(String appId) to manage access keys based on application IDs.
    • Introduced a new annotation MultipleConfig for managing multiple application IDs.
  • Changes in APIs

    • Updated method signatures in multiple configuration classes and services to include appId.
    • Added new methods for retrieving appId in relevant classes.
  • Refactor

    • Refactored internal data structures and methods to support the inclusion of appId.

These changes enhance the ability to manage and query configurations on a per-application basis, improving flexibility and granularity in configuration management.

TerryLam2010 avatar Jul 10 '24 07:07 TerryLam2010

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

github-actions[bot] avatar Jul 10 '24 07:07 github-actions[bot]

[!NOTE] Currently processing new changes in this PR. This may take a few minutes, please wait...

📥 Commits

Reviewing files that changed from the base of the PR and between 929b440b502d13bafd81edba76c6b76bbbe80dcc and 5a4507bf39aff28f6517b52ad0c087ca5b8ef072.

📒 Files selected for processing (1)
  • apollo-client/src/main/java/com/ctrip/framework/apollo/spring/spi/DefaultApolloConfigRegistrarHelper.java (5 hunks)
 ________________________________________
< C*deR*bb*t: The uncensored bug hunter. >
 ----------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ

Walkthrough

The recent updates to the Apollo Client introduce an appId parameter across multiple classes and methods. This enhancement improves configuration management by allowing retrieval and handling of configurations tailored to specific applications, facilitating greater flexibility and organization in multi-application environments. Additionally, the CHANGES.md file reflects a version update from 2.3.0 to 2.4.0, with a significant reduction in detailed entries.

Changes

Files/Groups Changes Summary
ConfigService.java, DefaultConfigManager.java, RemoteConfigLongPollService.java, DefaultConfigFactoryManager.java, PropertySourcesProcessor.java Added appId parameter to methods, enhancing multi-application configuration management.
AbstractSpringIntegrationTest.java, ConfigServiceTest.java, RemoteConfigLongPollServiceTest.java, PropertySourcesProcessorTest.java Updated test cases to reflect changes in method signatures and improve clarity in testing configurations.
AbstractConfig.java, AbstractConfigFile.java, AbstractConfigRepository.java, DefaultConfig.java, LocalFileConfigRepository.java, RemoteConfigRepository.java, SimpleConfig.java, YamlConfigFile.java Modified constructors and methods to include appId, improving configuration handling across various classes.
MockConfig.java, MockConfigFile.java, MockConfigFactory.java, MockConfigUtil.java Updated constructors and methods to incorporate appId, ensuring consistency in configuration handling.
ConfigUtil.java Added new methods for retrieving local cache directories and access keys based on appId.
CHANGES.md Updated milestone link and removed detailed entries for version 2.4.0.

Sequence Diagrams

Configuration Retrieval Flow

sequenceDiagram
    participant Client as Client
    participant ConfigService as ConfigService
    participant ConfigManager as ConfigManager
    participant ConfigRepository as ConfigRepository

    Client->>ConfigService: getConfig(appId, namespace)
    ConfigService->>ConfigManager: getConfig(appId, namespace)
    ConfigManager->>ConfigRepository: fetchConfig(appId, namespace)
    ConfigRepository-->>ConfigManager: return Config
    ConfigManager-->>ConfigService: return Config
    ConfigService-->>Client: return Config

Configuration Change Notification Flow

sequenceDiagram
    participant ConfigRepository as ConfigRepository
    participant RemoteConfigLongPollService as RemoteConfigLongPollService
    participant Client as Client
    
    ConfigRepository->>RemoteConfigLongPollService: submit(appId, namespace)
    RemoteConfigLongPollService->>Client: notify(appId, namespace, changes)
    Client-->>ConfigRepository: onRepositoryChange(appId, namespace, newProperties)

🐰 In fields of green, I hop with glee,
New app IDs bloom, oh what a spree!
Configs now dance, tailored with care,
Multi-app magic fills the air!
With each little change, our dreams take flight,
A brighter tomorrow, oh what a delight! 🌼

[!TIP]

You can customize the tone of the review comments and chat replies.

Set the tone_instructions setting in your project's settings in CodeRabbit to customize the tone of the review comments and chat replies. For example, you can set the tone to Act like a strict teacher, Act like a pirate and more.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Jul 10 '24 07:07 coderabbitai[bot]

Thanks, it may take some time to reivew. In the meantime, could you please sign the CLA following the instructions provided by the CLA Assistant Lite bot?

nobodyiam avatar Jul 14 '24 10:07 nobodyiam

I have read the CLA Document and I hereby sign the CLA

TerryLam2010 avatar Jul 16 '24 06:07 TerryLam2010

@TerryLam2010 It seems you committed the code with [email protected], which isn't associated with your GitHub account.

nobodyiam avatar Jul 20 '24 12:07 nobodyiam

The monitor metric #74 maybe changed if support multiple appId @Rawven

Anilople avatar Aug 12 '24 12:08 Anilople

如果支持多个 appId,监控指标#74可能会改变@Rawven

I'll adapt it after it's merged

Rawven avatar Aug 12 '24 12:08 Rawven

I have changed the Email for submitting code to [email protected], and changed the name to TerryLam2010. Have not submitted open source request merge before,help me please....

TerryLam2010 avatar Aug 14 '24 10:08 TerryLam2010

I have changed the Email for submitting code to [email protected], and changed the name to TerryLam2010. Have not submitted open source request merge before,help me please....

emm...You may first backup the local repo and try the following:

1. git checkout main
2. git checkout -b 20240703-apollo-multiple-appid-new
3. git merge --squash 20240703-apollo-multiple-appid
4. git commit -m "some commit message"
5. git push origin 20240703-apollo-multiple-appid-new:20240703-apollo-multiple-appid

nobodyiam avatar Aug 31 '24 09:08 nobodyiam

I have changed the Email for submitting code to [email protected], and changed the name to TerryLam2010. Have not submitted open source request merge before,help me please....

emm...You may first backup the local repo and try the following:

1. git checkout main
2. git checkout -b 20240703-apollo-multiple-appid-new
3. git merge --squash 20240703-apollo-multiple-appid
4. git commit -m "some commit message"
5. git push origin 20240703-apollo-multiple-appid-new:20240703-apollo-multiple-appid

I noticed the CLA check failed again, and it seems the original commits are back. Is there some mistaken operation on the branch?

image

nobodyiam avatar Oct 01 '24 03:10 nobodyiam

Jason, my unit tests pass perfectly when I run them locally, but fail when I run them on GitHub.

TerryLam2010 avatar Oct 24 '24 02:10 TerryLam2010

@TerryLam2010 As this pull request is quite large and already takes a lot of time in reviewing. I suggest scheduling an online meeting for a thorough, quick review. If that works for you, please email me at [email protected] to arrange a suitable time.

nobodyiam avatar Nov 06 '24 12:11 nobodyiam