You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by "moremind (via GitHub)" <gi...@apache.org> on 2023/09/27 11:49:22 UTC
[GitHub] [shenyu] moremind commented on a diff in pull request #5170: Register instance into discovery
moremind commented on code in PR #5170:
URL: https://github.com/apache/shenyu/pull/5170#discussion_r1338481752
##########
shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-springmvc/src/main/java/org/apache/shenyu/springboot/starter/client/springmvc/ShenyuSpringMvcClientInfoRegisterConfiguration.java:
##########
@@ -129,4 +133,23 @@ public ClientRegisterConfig clientRegisterConfig(final ShenyuClientConfig shenyu
final Environment env) {
return new ClientRegisterConfigImpl(shenyuClientConfig, RpcTypeEnum.HTTP, applicationContext, env);
}
+
+ /**
+ * InstanceRegisterListener.
+ *
+ * @param clientRegisterConfig clientRegisterConfig
+ * @param shenyuDiscoveryConfig shenyuDiscoveryConfig
+ * @return InstanceRegisterListener
+ */
+ @Bean
+ @ConditionalOnBean(ShenyuDiscoveryConfig.class)
+ public InstanceRegisterListener instanceRegisterListener(final ClientRegisterConfig clientRegisterConfig, final ShenyuDiscoveryConfig shenyuDiscoveryConfig) {
+ DiscoveryUpstreamData discoveryUpstreamData = new DiscoveryUpstreamData();
+ discoveryUpstreamData.setUrl(clientRegisterConfig.getHost() + ":" + clientRegisterConfig.getPort());
+ discoveryUpstreamData.setStatus(0);
+ discoveryUpstreamData.setWeight(Integer.parseInt(shenyuDiscoveryConfig.getWeight()));
+ discoveryUpstreamData.setProtocol(ShenyuClientConstants.HTTP);
Review Comment:
protocol can come from the user's configuration?
##########
shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-springmvc/src/main/java/org/apache/shenyu/springboot/starter/client/springmvc/ShenyuSpringMvcClientInfoRegisterConfiguration.java:
##########
@@ -129,4 +133,23 @@ public ClientRegisterConfig clientRegisterConfig(final ShenyuClientConfig shenyu
final Environment env) {
return new ClientRegisterConfigImpl(shenyuClientConfig, RpcTypeEnum.HTTP, applicationContext, env);
}
+
+ /**
+ * InstanceRegisterListener.
+ *
+ * @param clientRegisterConfig clientRegisterConfig
+ * @param shenyuDiscoveryConfig shenyuDiscoveryConfig
+ * @return InstanceRegisterListener
+ */
+ @Bean
+ @ConditionalOnBean(ShenyuDiscoveryConfig.class)
+ public InstanceRegisterListener instanceRegisterListener(final ClientRegisterConfig clientRegisterConfig, final ShenyuDiscoveryConfig shenyuDiscoveryConfig) {
+ DiscoveryUpstreamData discoveryUpstreamData = new DiscoveryUpstreamData();
+ discoveryUpstreamData.setUrl(clientRegisterConfig.getHost() + ":" + clientRegisterConfig.getPort());
+ discoveryUpstreamData.setStatus(0);
+ discoveryUpstreamData.setWeight(Integer.parseInt(shenyuDiscoveryConfig.getWeight()));
+ discoveryUpstreamData.setProtocol(ShenyuClientConstants.HTTP);
Review Comment:
https?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org