apache / apache/servicecomb-java-chassis

[QUESTION] - 2.x升级3.x适配方案

Open
#5,060 1 comment 0 reactions 0 assignees View on GitHub
question
Dominant language
Java
Stars
1.9k
Forks
814
Avg merge
8d 23h
Merged PRs (30d)
1

Description

### Steps to reproduce (if applicable)

问题1:
2.x中可以通过以下代码获取指定appid,serviceName的实例集合
````
MicroserviceVersionRule microService = DiscoveryManager.INSTANCE.getAppManager().getOrCreateMicroserviceVersionRule(
appId, serviceName, SERVICE_VERSION_RULE);
Map instanceMap = microService.getInstances();
````

3.x中api变化,应该怎么替换实现相同的功能
通过serviceCenterClient获取所有的微服务,然后再过滤,是否可行?或者有没有更好的平替方法?
```
ServiceCenterClient serviceCenterClient = BeanUtils.getBean(ServiceCenterClient.class);
List microserviceList = serviceCenterClient.getMicroserviceList().getServices();
```

问题2:2.x中PolicyRuleItem可以通过getMatch().match()判断某个请求头的值是否符合正则,3.x中要怎么替换适配?
问题3:2.x中MicroserviceCache.getInstance().getService()的替换方案

### What have you tried so far?

_No response_

### Additional context

_No response_

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by comparing the 2.x APIs named in the issue—MicroserviceVersionRule, PolicyRuleItem, and MicroserviceCache—with their 3.x counterparts in the ServiceComb Java Chassis API. Verify whether filtering ServiceCenterClient results and matching request-header values provide equivalent behavior. Done means documenting a confirmed replacement or limitation for each of the three migration questions.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, distributed-systems
Issue type
Documentation
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.