apache / apache/servicecomb-java-chassis

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

未关闭
#5,060 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
question
主要语言
Java
星标
1.9k
派生
814
平均合并
8 天 23 小时
30 天内合并 PR
1

描述

### 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_

贡献指南

这个仓库没有索引到贡献指南

调研方向

首先,将 issue 中提到的 2.x API—MicroserviceVersionRule、PolicyRuleItem 和 MicroserviceCache—与 ServiceComb Java Chassis API 中对应的 3.x API 进行比较。验证过滤 ServiceCenterClient 结果以及匹配请求头值是否能提供等效行为。对于三个迁移问题中的每一个,都记录了已确认的替代方案或限制后,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
java
领域
backend, distributed-systems
Issue 类型
文档
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。