Skip to content

Commit

Permalink
[type:refactor] refactor springcloud plugin register divide.
Browse files Browse the repository at this point in the history
  • Loading branch information
yunlongn committed Nov 11, 2024
1 parent 8b8c940 commit aba8a1b
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ protected Sextet<String[], String, String, ApiHttpMethodEnum[], RpcTypeEnum, Str
List<ApiHttpMethodEnum> collect = Stream.of(requestMethods).map(item -> ApiHttpMethodEnum.of(item.name())).collect(Collectors.toList());
ApiHttpMethodEnum[] apiHttpMethodEnums = collect.toArray(new ApiHttpMethodEnum[]{});
String version = "v0.01";
return Sextet.with(values, consume, produce, apiHttpMethodEnums, RpcTypeEnum.SPRING_CLOUD, version);
return Sextet.with(values, consume, produce, apiHttpMethodEnums, RpcTypeEnum.HTTP, version);
}

@Override
Expand All @@ -132,7 +132,7 @@ protected Map<String, Object> getBeans(final ApplicationContext context) {
.contextPath(getContextPath())
.appName(getAppName())
.path(UriComponentsBuilder.fromUriString(PathUtils.decoratorPathWithSlash(getContextPath()) + EVERY_PATH).build().encode().toUriString())
.rpcType(RpcTypeEnum.SPRING_CLOUD.getName())
.rpcType(RpcTypeEnum.HTTP.getName())
.enabled(true)
.ruleName(getContextPath())
.namespaceId(namespaceId)
Expand All @@ -152,7 +152,7 @@ protected URIRegisterDTO buildURIRegisterDTO(final ApplicationContext context, f
.appName(getAppName())
.host(super.getHost())
.port(Integer.valueOf(getPort()))
.rpcType(RpcTypeEnum.SPRING_CLOUD.getName())
.rpcType(RpcTypeEnum.HTTP.getName())
.eventType(EventType.REGISTER)
.namespaceId(namespaceId)
.build();
Expand All @@ -163,7 +163,7 @@ protected URIRegisterDTO buildURIRegisterDTO(final ApplicationContext context, f

@Override
protected String getClientName() {
return RpcTypeEnum.SPRING_CLOUD.getName();
return RpcTypeEnum.HTTP.getName();
}

@Override
Expand Down Expand Up @@ -262,7 +262,7 @@ protected MetaDataRegisterDTO buildMetaDataDTO(final Object bean,
.map(Class::getName)
.collect(Collectors.joining(","))
).orElse(null))
.rpcType(RpcTypeEnum.SPRING_CLOUD.getName())
.rpcType(RpcTypeEnum.HTTP.getName())
.enabled(shenyuClient.enabled())
.ruleName(StringUtils.defaultIfBlank(shenyuClient.ruleName(), path))
.namespaceId(namespaceId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class RequestMappingProcessor implements ApiAnnotationProcessor<RequestMa

@Override
public List<String> supportedClient() {
return ListUtil.of(RpcTypeEnum.SPRING_CLOUD.getName());
return ListUtil.of(RpcTypeEnum.HTTP.getName());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public SpringCloudApiBeansExtractor() {

@Override
public String clientName() {
return RpcTypeEnum.SPRING_CLOUD.getName();
return RpcTypeEnum.HTTP.getName();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ protected MetaDataRegisterDTO preParse(final ApiBean apiBean) {
.path(apiPath)
.pathDesc(annotation.desc())
.parameterTypes(null)
.rpcType(RpcTypeEnum.SPRING_CLOUD.getName())
.rpcType(RpcTypeEnum.HTTP.getName())
.enabled(annotation.enabled())
.ruleName(StringUtils.defaultIfBlank(annotation.ruleName(), apiPath))
.build();
Expand Down Expand Up @@ -144,7 +144,7 @@ protected List<MetaDataRegisterDTO> parse(final ApiBean.ApiDefinition apiDefinit
.path(apiPath)
.pathDesc(pathDesc)
.parameterTypes(apiDefinition.getParameterTypes())
.rpcType(RpcTypeEnum.SPRING_CLOUD.getName())
.rpcType(RpcTypeEnum.HTTP.getName())
.enabled(enabled)
.ruleName(ruleName)
.build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ shenyu:
password: 123456
nacosNameSpace: ShenyuRegisterCenter
client:
springCloud:
http:
props:
contextPath: /springcloud
addPrefixed: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@ public SpringCloudClientEventListener springCloudClientEventListener(final Sheny
public ClientRegisterConfig clientRegisterConfig(final ShenyuClientConfig shenyuClientConfig,
final ApplicationContext applicationContext,
final Environment env) {
return new ClientRegisterConfigImpl(shenyuClientConfig, RpcTypeEnum.SPRING_CLOUD, applicationContext, env);
return new ClientRegisterConfigImpl(shenyuClientConfig, RpcTypeEnum.HTTP, applicationContext, env);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public ClientDiscoveryConfigRefreshedEventListener clientDiscoveryConfigRefreshe
final HttpClientRegisterRepository httpClientRegisterRepository,
final ClientRegisterConfig clientRegisterConfig,
final ShenyuClientConfig shenyuClientConfig) {
return new ClientDiscoveryConfigRefreshedEventListener(shenyuDiscoveryConfig, httpClientRegisterRepository, clientRegisterConfig, PluginEnum.SPRING_CLOUD, shenyuClientConfig);
return new ClientDiscoveryConfigRefreshedEventListener(shenyuDiscoveryConfig, httpClientRegisterRepository, clientRegisterConfig, PluginEnum.DIVIDE, shenyuClientConfig);
}

/**
Expand Down

0 comments on commit aba8a1b

Please sign in to comment.