refactor: rename the module name (#3084)

refactor: rename the module name
pull/3085/head
Steve Rao 2 years ago committed by GitHub
parent 3ab16864f7
commit 4176e8f6df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -227,12 +227,12 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-controlplane-istio</artifactId> <artifactId>spring-cloud-starter-xds-adapter</artifactId>
<version>${revision}</version> <version>${revision}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-controlplane-opensergo</artifactId> <artifactId>spring-cloud-starter-opensergo-adapter</artifactId>
<version>${revision}</version> <version>${revision}</version>
</dependency> </dependency>
<dependency> <dependency>

@ -10,12 +10,12 @@ image::pic/resource-transform.png[]
Spring Cloud Alibaba Governance的resource-transform模块会将不同控制面下发的配置进行统一的转换将来自IstioOpenSergo等控制面下发的配置统一转换为Spring Cloud Alibaba统一抽象出的数据结构以供后续使用 Spring Cloud Alibaba Governance的resource-transform模块会将不同控制面下发的配置进行统一的转换将来自IstioOpenSergo等控制面下发的配置统一转换为Spring Cloud Alibaba统一抽象出的数据结构以供后续使用
如果在您的项目中使用Istio来实现配置转换需要使用group ID 为 `com.alibaba.cloud` 和artifact ID 为 `spring-cloud-starter-alibaba-controlplane-istio` 的starter 如果在您的项目中使用Istio来实现配置转换需要使用group ID 为 `com.alibaba.cloud` 和artifact ID 为 `spring-cloud-starter-xds-adapter` 的starter
[source,xml,indent=0] [source,xml,indent=0]
---- ----
<dependency> <dependency>
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-controlplane-istio</artifactId> <artifactId>spring-cloud-starter-xds-adapter</artifactId>
</dependency> </dependency>
---- ----

@ -11,12 +11,12 @@ image::pic/resource-transform.png[]
The resource-transform module of Spring Cloud Alibaba Governance will uniformly transform the configurations published by different control planes, like Istio and OperSergo, into the unified abstract data structure of Spring Cloud Alibaba for subsequent use. The resource-transform module of Spring Cloud Alibaba Governance will uniformly transform the configurations published by different control planes, like Istio and OperSergo, into the unified abstract data structure of Spring Cloud Alibaba for subsequent use.
If you use Istio in your project to transform the configuration, you need to use a starter with a group ID of `com.alibaba.cloud` and an artifact ID of `spring-cloud-starter-alibaba-controlplane-istio`. If you use Istio in your project to transform the configuration, you need to use a starter with a group ID of `com.alibaba.cloud` and an artifact ID of `spring-cloud-starter-xds-adapter`.
[source,xml,indent=0] [source,xml,indent=0]
---- ----
<dependency> <dependency>
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-controlplane-istio</artifactId> <artifactId>spring-cloud-starter-xds-adapter</artifactId>
</dependency> </dependency>
---- ----

@ -26,7 +26,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-controlplane-istio</artifactId> <artifactId>spring-cloud-starter-xds-adapter</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>

@ -32,7 +32,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-controlplane-istio</artifactId> <artifactId>spring-cloud-starter-xds-adapter</artifactId>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>spring-web</groupId> <groupId>spring-web</groupId>

@ -26,7 +26,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-controlplane-istio</artifactId> <artifactId>spring-cloud-starter-xds-adapter</artifactId>
</dependency> </dependency>
``` ```
2. 在应用的 `src/main/resources/application.yml` 配置文件中配置Istio相关元数据: 2. 在应用的 `src/main/resources/application.yml` 配置文件中配置Istio相关元数据:

@ -27,7 +27,7 @@ Before launching the example for demonstration, let's look at how a Spring Cloud
<dependency> <dependency>
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-controlplane-istio</artifactId> <artifactId>spring-cloud-starter-xds-adapter</artifactId>
</dependency> </dependency>
``` ```
2. Configure Istio related metadata in the `src/main/resources/application` yml configuration file: 2. Configure Istio related metadata in the `src/main/resources/application` yml configuration file:

@ -38,7 +38,7 @@
<dependency> <dependency>
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-controlplane-istio</artifactId> <artifactId>spring-cloud-starter-xds-adapter</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>

@ -38,7 +38,7 @@
<dependency> <dependency>
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-controlplane-opensergo</artifactId> <artifactId>spring-cloud-starter-opensergo-adapter</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>

@ -166,7 +166,7 @@ public void getDataFromControlPlaneTest() {
- [VirtualService](https://istio.io/latest/zh/docs/reference/config/networking/virtual-service/) - [VirtualService](https://istio.io/latest/zh/docs/reference/config/networking/virtual-service/)
- [DestinationRule](https://istio.io/latest/zh/docs/reference/config/networking/destination-rule/) - [DestinationRule](https://istio.io/latest/zh/docs/reference/config/networking/destination-rule/)
### 配置 ### 配置
1. 首先修改pom.xml 文件,引入`spring-cloud-starter-alibaba-governance-routing`依赖。同时引入Spring Cloud Alibaba的`spring-cloud-starter-alibaba-controlplane-istio`模块 1. 首先修改pom.xml 文件,引入`spring-cloud-starter-alibaba-governance-routing`依赖。同时引入Spring Cloud Alibaba的`spring-cloud-starter-xds-adapter`模块
```xml ```xml
<dependency> <dependency>
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
@ -174,7 +174,7 @@ public void getDataFromControlPlaneTest() {
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-controlplane-istio</artifactId> <artifactId>spring-cloud-starter-xds-adapter</artifactId>
</dependency> </dependency>
``` ```
2. 在`src/main/resources/application.yml`配置文件中配置Istio控制面的相关信息: 2. 在`src/main/resources/application.yml`配置文件中配置Istio控制面的相关信息:
@ -291,7 +291,7 @@ kubectl delete DestinationRule my-destination-rule
## 集成OpenSergo ## 集成OpenSergo
**注意 本章节只是为了便于您理解接入方式,本示例代码中已经完成接入工作,您无需再进行修改。** **注意 本章节只是为了便于您理解接入方式,本示例代码中已经完成接入工作,您无需再进行修改。**
1. 首先,修改`pom.xml` 文件,引入`spring-cloud-starter-alibaba-governance-routing`依赖。同时引入Spring Cloud Alibaba的`spring-cloud-starter-alibaba-controlplane-opensergo`模块 1. 首先,修改`pom.xml` 文件,引入`spring-cloud-starter-alibaba-governance-routing`依赖。同时引入Spring Cloud Alibaba的`spring-cloud-starter-opensergo-adapter`模块
``` ```
<dependency> <dependency>
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
@ -299,7 +299,7 @@ kubectl delete DestinationRule my-destination-rule
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-controlplane-opensergo</artifactId> <artifactId>spring-cloud-starter-opensergo-adapter</artifactId>
</dependency> </dependency>
``` ```
2. 在`application.properties`配置文件中配置OpenSergo控制面的相关信息 2. 在`application.properties`配置文件中配置OpenSergo控制面的相关信息
@ -372,7 +372,7 @@ kubectl delete DestinationRule my-destination-rule
## 集成OpenSergo ## 集成OpenSergo
**注意 本章节只是为了便于您理解接入方式,本示例代码中已经完成接入工作,您无需再进行修改。** **注意 本章节只是为了便于您理解接入方式,本示例代码中已经完成接入工作,您无需再进行修改。**
1. 首先修改pom.xml 文件,引入`spring-cloud-starter-alibaba-governance-routing`依赖。同时引入Spring Cloud Alibaba的`spring-cloud-starter-alibaba-controlplane-opensergo`模块 1. 首先修改pom.xml 文件,引入`spring-cloud-starter-alibaba-governance-routing`依赖。同时引入Spring Cloud Alibaba的`spring-cloud-starter-opensergo-adapter`模块
``` ```
<dependency> <dependency>
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
@ -380,7 +380,7 @@ kubectl delete DestinationRule my-destination-rule
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-controlplane-opensergo</artifactId> <artifactId>spring-cloud-starter-opensergo-adapter</artifactId>
</dependency> </dependency>
``` ```
2. 在application.properties配置文件中配置OpenSergo控制面的相关信息 2. 在application.properties配置文件中配置OpenSergo控制面的相关信息

@ -167,7 +167,7 @@ Please refer to [install](https://istio.io/latest/zh/docs/setup/install/) chapte
### Introduction to Istio traffic control rules ### Introduction to Istio traffic control rules
- [overview](https://istio.io/latest/zh/docs/concepts/security/#authorization) - [overview](https://istio.io/latest/zh/docs/concepts/security/#authorization)
- [detail](https://istio.io/latest/zh/docs/reference/config/security/) - [detail](https://istio.io/latest/zh/docs/reference/config/security/)
1. First, modify the pom.xml file to introduce the `spring-cloud-starter-alibaba-governance-routing` and `spring-cloud-starter-alibaba-controlplane-istio` dependency 1. First, modify the pom.xml file to introduce the `spring-cloud-starter-alibaba-governance-routing` and `spring-cloud-starter-xds-adapter` dependency
```xml ```xml
<dependency> <dependency>
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
@ -175,7 +175,7 @@ Please refer to [install](https://istio.io/latest/zh/docs/setup/install/) chapte
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-controlplane-istio</artifactId> <artifactId>spring-cloud-starter-xds-adapter</artifactId>
</dependency> </dependency>
``` ```
2. Configure application.yml for Istio control plane: 2. Configure application.yml for Istio control plane:
@ -292,7 +292,7 @@ After the rule is deleted, the routing policy is not determined by whether the r
## Integrating OpenSergo ## Integrating OpenSergo
**Note that this section is only for your convenience in understanding the access method. The access work has been completed in this sample code, and you do not need to modify it.** **Note that this section is only for your convenience in understanding the access method. The access work has been completed in this sample code, and you do not need to modify it.**
### Configure ### Configure
1. First, modify the pom.xml file to introduce the `spring-cloud-starter-alibaba-governance-routing` and `spring-cloud-starter-alibaba-controlplane-opensergo` dependency 1. First, modify the pom.xml file to introduce the `spring-cloud-starter-alibaba-governance-routing` and `spring-cloud-starter-opensergo-adapter` dependency
``` ```
<dependency> <dependency>
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
@ -300,7 +300,7 @@ After the rule is deleted, the routing policy is not determined by whether the r
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-controlplane-opensergo</artifactId> <artifactId>spring-cloud-starter-opensergo-adapter</artifactId>
</dependency> </dependency>
``` ```
2. Configure application.yml for OpenSergo control plane 2. Configure application.yml for OpenSergo control plane

@ -26,8 +26,8 @@
<module>spring-cloud-alibaba-sentinel-datasource</module> <module>spring-cloud-alibaba-sentinel-datasource</module>
<module>spring-cloud-alibaba-sentinel-gateway</module> <module>spring-cloud-alibaba-sentinel-gateway</module>
<module>spring-cloud-starter-alibaba-appactive</module> <module>spring-cloud-starter-alibaba-appactive</module>
<module>spring-cloud-starter-alibaba-controlplane-istio</module> <module>spring-cloud-starter-xds-adapter</module>
<module>spring-cloud-starter-alibaba-controlplane-opensergo</module> <module>spring-cloud-starter-opensergo-adapter</module>
<module>spring-cloud-starter-alibaba-governance-auth</module> <module>spring-cloud-starter-alibaba-governance-auth</module>
<module>spring-cloud-starter-alibaba-governance-routing</module> <module>spring-cloud-starter-alibaba-governance-routing</module>
<module>spring-cloud-alibaba-commons</module> <module>spring-cloud-alibaba-commons</module>

@ -47,7 +47,8 @@ public final class URIRegister {
private URIRegister() { private URIRegister() {
} }
public static void collectUris(List<FilterRegistrationBean<? extends Filter>> beanList) { public static void collectUris(
List<FilterRegistrationBean<? extends Filter>> beanList) {
if (CollectionUtils.isEmpty(beanList)) { if (CollectionUtils.isEmpty(beanList)) {
return; return;
} }
@ -60,14 +61,16 @@ public final class URIRegister {
} }
Collection<String> urlPatterns = filterRegistrationBean.getUrlPatterns(); Collection<String> urlPatterns = filterRegistrationBean.getUrlPatterns();
if (filter instanceof CoreServiceFilter) { if (filter instanceof CoreServiceFilter) {
hasWildChar = collectServiceMetas(serviceMetaList, hasWildChar, urlPatterns, hasWildChar = collectServiceMetas(serviceMetaList, hasWildChar,
ResourceActiveType.UNIT_RESOURCE_TYPE); urlPatterns, ResourceActiveType.UNIT_RESOURCE_TYPE);
} else if (filter instanceof GlobalServiceFilter) { }
hasWildChar = collectServiceMetas(serviceMetaList, hasWildChar, urlPatterns, else if (filter instanceof GlobalServiceFilter) {
ResourceActiveType.CENTER_RESOURCE_TYPE); hasWildChar = collectServiceMetas(serviceMetaList, hasWildChar,
} else if (filter instanceof GeneralServiceFilter) { urlPatterns, ResourceActiveType.CENTER_RESOURCE_TYPE);
hasWildChar = collectServiceMetas(serviceMetaList, hasWildChar, urlPatterns, }
ResourceActiveType.NORMAL_RESOURCE_TYPE); else if (filter instanceof GeneralServiceFilter) {
hasWildChar = collectServiceMetas(serviceMetaList, hasWildChar,
urlPatterns, ResourceActiveType.NORMAL_RESOURCE_TYPE);
} }
} }
if (CollectionUtils.isEmpty(serviceMetaList)) { if (CollectionUtils.isEmpty(serviceMetaList)) {
@ -75,7 +78,8 @@ public final class URIRegister {
} }
if (!hasWildChar) { if (!hasWildChar) {
// 保证所有 service(app+uri) 都纳入管理,不然不好做缓存管理 // 保证所有 service(app+uri) 都纳入管理,不然不好做缓存管理
collectServiceMeta(serviceMetaList, MATCH_ALL, ResourceActiveType.NORMAL_RESOURCE_TYPE); collectServiceMeta(serviceMetaList, MATCH_ALL,
ResourceActiveType.NORMAL_RESOURCE_TYPE);
} }
initServiceMetaObject(serviceMetaList); initServiceMetaObject(serviceMetaList);
} }
@ -95,8 +99,8 @@ public final class URIRegister {
} }
/** /**
* Collect {@link ServiceMeta} into the given <i>serviceMetaList</i> according to * Collect {@link ServiceMeta} into the given <i>serviceMetaList</i> according to each
* each item of the given <i>urlPatterns</i> and the given <i>resourceActiveType</i>, * item of the given <i>urlPatterns</i> and the given <i>resourceActiveType</i>,
* finally determine whether <i>hasWildChar</i> is a new wildChar. * finally determine whether <i>hasWildChar</i> is a new wildChar.
* @param serviceMetaList extended list * @param serviceMetaList extended list
* @param hasWildChar keyword to be determined * @param hasWildChar keyword to be determined
@ -104,8 +108,9 @@ public final class URIRegister {
* @param resourceActiveType attribute of {@link ServiceMeta} * @param resourceActiveType attribute of {@link ServiceMeta}
* @return is new wildChar * @return is new wildChar
*/ */
private static boolean collectServiceMetas(List<ServiceMeta> serviceMetaList, boolean hasWildChar, private static boolean collectServiceMetas(List<ServiceMeta> serviceMetaList,
Collection<String> urlPatterns, String resourceActiveType) { boolean hasWildChar, Collection<String> urlPatterns,
String resourceActiveType) {
for (String urlPattern : urlPatterns) { for (String urlPattern : urlPatterns) {
if (MATCH_ALL.equalsIgnoreCase(urlPattern)) { if (MATCH_ALL.equalsIgnoreCase(urlPattern)) {
hasWildChar = true; hasWildChar = true;
@ -116,14 +121,14 @@ public final class URIRegister {
} }
/** /**
* Collect {@link ServiceMeta} into the given <i>serviceMetaList</i> according to * Collect {@link ServiceMeta} into the given <i>serviceMetaList</i> according to the
* the given <i>urlPattern</i> and the given <i>resourceActiveType</i>. * given <i>urlPattern</i> and the given <i>resourceActiveType</i>.
* @param serviceMetaList extended list * @param serviceMetaList extended list
* @param urlPattern attribute of {@link ServiceMeta} * @param urlPattern attribute of {@link ServiceMeta}
* @param resourceActiveType attribute of {@link ServiceMeta} * @param resourceActiveType attribute of {@link ServiceMeta}
*/ */
private static void collectServiceMeta(List<ServiceMeta> serviceMetaList, String urlPattern, private static void collectServiceMeta(List<ServiceMeta> serviceMetaList,
String resourceActiveType) { String urlPattern, String resourceActiveType) {
ServiceMeta serviceMeta = new ServiceMeta(urlPattern, resourceActiveType); ServiceMeta serviceMeta = new ServiceMeta(urlPattern, resourceActiveType);
serviceMetaList.add(serviceMeta); serviceMetaList.add(serviceMeta);
} }

@ -591,8 +591,7 @@ public class NacosConfigProperties {
} }
/** /**
* refer * refer https://github.com/alibaba/spring-cloud-alibaba/issues/2872
* https://github.com/alibaba/spring-cloud-alibaba/issues/2872
* https://github.com/alibaba/spring-cloud-alibaba/issues/2869 . * https://github.com/alibaba/spring-cloud-alibaba/issues/2869 .
*/ */
private String resolveNamespace() { private String resolveNamespace() {

@ -39,9 +39,9 @@ import org.springframework.util.StringUtils;
/** /**
* Parsing for XML requires overwriting the default * Parsing for XML requires overwriting the default
* {@link PropertiesPropertySourceLoader}, because it internally rigorously validates * {@link PropertiesPropertySourceLoader}, because it internally rigorously validates THE
* THE XML in a way that makes it difficult to customize the * XML in a way that makes it difficult to customize the configuration; at finally, make
* configuration; at finally, make sure it's in the first place. * sure it's in the first place.
* *
* @author zkz * @author zkz
*/ */

@ -35,13 +35,13 @@ public class NacosJsonPropertySourceLoaderTests {
@Test @Test
public void testJsonPropWithComment() throws IOException { public void testJsonPropWithComment() throws IOException {
String propJsonStr = "{\n" String propJsonStr = "{\n" + " // test comment\n" + " \"name\": \"jack\"\n"
+ " // test comment\n"
+ " \"name\": \"jack\"\n"
+ "}"; + "}";
ByteArrayResource resource = new ByteArrayResource(propJsonStr.getBytes()); ByteArrayResource resource = new ByteArrayResource(propJsonStr.getBytes());
List<PropertySource<?>> result = new NacosJsonPropertySourceLoader().doLoad("test.json", resource); List<PropertySource<?>> result = new NacosJsonPropertySourceLoader()
.doLoad("test.json", resource);
assertThat(result).hasSize(1); assertThat(result).hasSize(1);
assertThat(result.get(0).getProperty("name")).isEqualTo("jack"); assertThat(result.get(0).getProperty("name")).isEqualTo("jack");
} }
} }

@ -53,7 +53,7 @@ public class InetIPv6Utils {
try { try {
for (Enumeration<NetworkInterface> nics = NetworkInterface for (Enumeration<NetworkInterface> nics = NetworkInterface
.getNetworkInterfaces(); nics.hasMoreElements(); ) { .getNetworkInterfaces(); nics.hasMoreElements();) {
NetworkInterface ifc = nics.nextElement(); NetworkInterface ifc = nics.nextElement();
if (ifc.isUp() || !ifc.isVirtual() || !ifc.isLoopback()) { if (ifc.isUp() || !ifc.isVirtual() || !ifc.isLoopback()) {
if (address != null) { if (address != null) {
@ -61,7 +61,7 @@ public class InetIPv6Utils {
} }
if (!ignoreInterface(ifc.getDisplayName())) { if (!ignoreInterface(ifc.getDisplayName())) {
for (Enumeration<InetAddress> addrs = ifc for (Enumeration<InetAddress> addrs = ifc
.getInetAddresses(); addrs.hasMoreElements(); ) { .getInetAddresses(); addrs.hasMoreElements();) {
InetAddress inetAddress = addrs.nextElement(); InetAddress inetAddress = addrs.nextElement();
if (inetAddress instanceof Inet6Address if (inetAddress instanceof Inet6Address
// filter ::1 // filter ::1
@ -147,7 +147,6 @@ public class InetIPv6Utils {
/** /**
* If the address is Unique Local Address. * If the address is Unique Local Address.
*
* @param inetAddress {@link InetAddress} * @param inetAddress {@link InetAddress}
* @return {@code true} if the address is Unique Local Address,otherwise {@code false} * @return {@code true} if the address is Unique Local Address,otherwise {@code false}
*/ */

@ -38,12 +38,14 @@ public class MockNamingService implements NamingService {
} }
@Override @Override
public void batchRegisterInstance(String s, String s1, List<Instance> list) throws NacosException { public void batchRegisterInstance(String s, String s1, List<Instance> list)
throws NacosException {
} }
@Override @Override
public void batchDeregisterInstance(String s, String s1, List<Instance> list) throws NacosException { public void batchDeregisterInstance(String s, String s1, List<Instance> list)
throws NacosException {
} }

@ -35,11 +35,11 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
@PowerMockRunnerDelegate(SpringRunner.class) @PowerMockRunnerDelegate(SpringRunner.class)
@SpringBootTest( @SpringBootTest(classes = InetIPv6UtilsTest.TestConfig.class,
classes = InetIPv6UtilsTest.TestConfig.class, properties = { "spring.cloud.nacos.discovery.ipType=IPv6" },
properties = {"spring.cloud.nacos.discovery.ipType=IPv6"},
webEnvironment = RANDOM_PORT) webEnvironment = RANDOM_PORT)
public class InetIPv6UtilsTest { public class InetIPv6UtilsTest {
@Autowired @Autowired
NacosDiscoveryProperties properties; NacosDiscoveryProperties properties;
@ -52,9 +52,9 @@ public class InetIPv6UtilsTest {
@Configuration @Configuration
@EnableAutoConfiguration @EnableAutoConfiguration
@ImportAutoConfiguration( @ImportAutoConfiguration(NacosDiscoveryClientConfiguration.class)
NacosDiscoveryClientConfiguration.class)
public static class TestConfig { public static class TestConfig {
} }
} }

@ -30,14 +30,18 @@ import org.springframework.beans.factory.config.BeanPostProcessor;
*/ */
public class SeataFeignBuilderBeanPostProcessor implements BeanPostProcessor { public class SeataFeignBuilderBeanPostProcessor implements BeanPostProcessor {
private static final Logger LOGGER = LoggerFactory.getLogger(SeataFeignBuilderBeanPostProcessor.class); private static final Logger LOGGER = LoggerFactory
.getLogger(SeataFeignBuilderBeanPostProcessor.class);
@Override @Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { public Object postProcessAfterInitialization(Object bean, String beanName)
throws BeansException {
if (bean instanceof Feign.Builder) { if (bean instanceof Feign.Builder) {
((Feign.Builder) bean).retryer(Retryer.NEVER_RETRY); ((Feign.Builder) bean).retryer(Retryer.NEVER_RETRY);
LOGGER.info("change the retryer of the bean '{}' to 'Retryer.NEVER_RETRY'", beanName); LOGGER.info("change the retryer of the bean '{}' to 'Retryer.NEVER_RETRY'",
beanName);
} }
return bean; return bean;
} }
} }

@ -41,4 +41,5 @@ public class SeataFeignRequestInterceptor implements RequestInterceptor {
seataXid.add(xid); seataXid.add(xid);
template.header(RootContext.KEY_XID, xid); template.header(RootContext.KEY_XID, xid);
} }
} }

@ -9,7 +9,7 @@
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<artifactId>spring-cloud-starter-alibaba-controlplane-opensergo</artifactId> <artifactId>spring-cloud-starter-opensergo-adapter</artifactId>
<name>Spring Cloud Alibaba OpenSergo Control Plane</name> <name>Spring Cloud Alibaba OpenSergo Control Plane</name>
<properties> <properties>

@ -102,19 +102,18 @@ public final class RocketMQConsumerFactory {
* @param extendedConsumerProperties extendedConsumerProperties * @param extendedConsumerProperties extendedConsumerProperties
* @return DefaultLitePullConsumer * @return DefaultLitePullConsumer
*/ */
public static DefaultLitePullConsumer initPullConsumer( public static DefaultLitePullConsumer initPullConsumer(String topic,
String topic,
ExtendedConsumerProperties<RocketMQConsumerProperties> extendedConsumerProperties) { ExtendedConsumerProperties<RocketMQConsumerProperties> extendedConsumerProperties) {
RocketMQConsumerProperties consumerProperties = extendedConsumerProperties RocketMQConsumerProperties consumerProperties = extendedConsumerProperties
.getExtension(); .getExtension();
boolean anonymous = !StringUtils.hasLength(consumerProperties.getGroup()); boolean anonymous = !StringUtils.hasLength(consumerProperties.getGroup());
/*** /***
* When using DLQ, at least the group property must be provided for proper naming of the DLQ destination * When using DLQ, at least the group property must be provided for proper naming
* According to https://docs.spring.io/spring-cloud-stream/docs/3.2.1/reference/html/spring-cloud-stream.html#spring-cloud-stream-reference * of the DLQ destination According to
* https://docs.spring.io/spring-cloud-stream/docs/3.2.1/reference/html/spring-cloud-stream.html#spring-cloud-stream-reference
*/ */
if (anonymous && NamespaceUtil.isDLQTopic(topic)) { if (anonymous && NamespaceUtil.isDLQTopic(topic)) {
throw new RuntimeException( throw new RuntimeException("group must be configured for DLQ" + topic);
"group must be configured for DLQ" + topic);
} }
if (anonymous) { if (anonymous) {
consumerProperties.setGroup(RocketMQUtils.anonymousGroup(topic)); consumerProperties.setGroup(RocketMQUtils.anonymousGroup(topic));

@ -86,8 +86,8 @@ public class RocketMQMessageSource extends AbstractMessageSource<Object>
throw new IllegalStateException( throw new IllegalStateException(
"pull consumer already running. " + this.toString()); "pull consumer already running. " + this.toString());
} }
this.consumer = RocketMQConsumerFactory this.consumer = RocketMQConsumerFactory.initPullConsumer(topic,
.initPullConsumer(topic, extendedConsumerProperties); extendedConsumerProperties);
// This parameter must be 1, otherwise doReceive cannot be handled singly. // This parameter must be 1, otherwise doReceive cannot be handled singly.
// this.consumer.setPullBatchSize(1); // this.consumer.setPullBatchSize(1);
this.consumer.subscribe(topic, messageSelector); this.consumer.subscribe(topic, messageSelector);

@ -46,15 +46,14 @@ public class RocketMQCommonProperties implements Serializable {
/** /**
* Consumers of the same role is required to have exactly same subscriptions and * Consumers of the same role is required to have exactly same subscriptions and
* consumerGroup to correctly achieve load balance. It's required and needs to be * consumerGroup to correctly achieve load balance. It's required and needs to be
* globally unique. * globally unique. <br>
* <br> * Producer group conceptually aggregates all producer instances of exactly same role,
* Producer group conceptually aggregates all producer instances of * which is particularly important when transactional messages are involved. For
* exactly same role, which is particularly important when transactional messages are * non-transactional messages, it does not matter as long as it's unique per process.
* involved. For non-transactional messages, it does not matter as long as it's unique * See <a href="http://rocketmq.apache.org/docs/core-concept/">here</a> for further
* per process. See <a href="http://rocketmq.apache.org/docs/core-concept/">here</a> * discussion. However, group for non-transactional messages can indicate whether the
* for further discussion. However, group for non-transactional messages can indicate * internal RocketMQProducer should be reused (Only the bindings that use the same
* whether the internal RocketMQProducer should be reused (Only the bindings that use * group can be reused).
* the same group can be reused).
*/ */
private String group; private String group;

@ -108,4 +108,5 @@ public final class RocketMQUtils {
public static String anonymousGroup(final String destination) { public static String anonymousGroup(final String destination) {
return RocketMQConst.DEFAULT_GROUP + "_" + destination; return RocketMQConst.DEFAULT_GROUP + "_" + destination;
} }
} }

@ -9,7 +9,7 @@
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<artifactId>spring-cloud-starter-alibaba-controlplane-istio</artifactId> <artifactId>spring-cloud-starter-xds-adapter</artifactId>
<name>Spring Cloud Alibaba Istio Control Plane</name> <name>Spring Cloud Alibaba Istio Control Plane</name>
<properties> <properties>

@ -122,8 +122,7 @@ public class RoutingXdsResolveFilter
return matchService; return matchService;
} }
private List<Rule> match2RouteRules( private List<Rule> match2RouteRules(RouteMatch routeMatch) {
RouteMatch routeMatch) {
List<Rule> routeRules = new ArrayList<>(); List<Rule> routeRules = new ArrayList<>();
for (HeaderMatcher headerMatcher : routeMatch.getHeadersList()) { for (HeaderMatcher headerMatcher : routeMatch.getHeadersList()) {
HeaderRoutingRule headerRule = ConvUtil HeaderRoutingRule headerRule = ConvUtil
Loading…
Cancel
Save