dragon-zhang commented on code in PR #3851:
URL: https://github.com/apache/shenyu/pull/3851#discussion_r945811190
##########
shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-motan/src/main/java/org/apache/shenyu/springboot/starter/client/motan/ShenyuMotanClientConfiguration.java:
##########
@@ -46,4 +57,78 @@ public class ShenyuMotanClientConfiguration {
public MotanServiceEventListener motanServiceEventListener(final
ShenyuClientConfig clientConfig, final ShenyuClientRegisterRepository
shenyuClientRegisterRepository) {
return new
MotanServiceEventListener(clientConfig.getClient().get(RpcTypeEnum.MOTAN.getName()),
shenyuClientRegisterRepository);
}
+
+ /**
+ * motan registry.
+ *
+ * @return registryProperties
+ */
+ @Bean
+ @ConfigurationProperties(prefix = "motan.registry")
+ public RegistryProperties registryProperties() {
+ return new RegistryProperties();
+ }
+
+ /**
+ * shenyu motan properties.
+ *
+ * @return shenyuMotanProperties
+ */
+ @Bean
+ @ConfigurationProperties(prefix = "shenyu.client.motan")
+ public ShenyuMotanProperties shenyuMotanProperties() {
+ return new ShenyuMotanProperties();
+ }
+
+ /**
+ * define the annotation bean, set the scan package.
+ * @param packagePath package path
+ * @return annotationBean
+ */
+
+ @Bean
+
@Value("${shenyu.client.motan.packagePath:org.apache.shenyu.examples.motan.service}")
+ public AnnotationBean motanAnnotationBean(final String packagePath) {
+ AnnotationBean motanAnnotationBean = new AnnotationBean();
+ motanAnnotationBean.setPackage(packagePath);
+ return motanAnnotationBean;
+ }
+
+ /**
+ * define a bean with name registryConfig1 of RegistryConfigBean.
+ * @param properties registry properties
+ * @return registryConfig1
+ */
+ @Bean
+ public RegistryConfigBean registryConfig(final RegistryProperties
properties) {
+ RegistryConfigBean config = new RegistryConfigBean();
+ config.setRegProtocol(properties.getProtocol());
+ config.setAddress(properties.getAddress());
+ return config;
+ }
+
+ /**
+ * define a bean with name baseServiceConfig of BasicServiceConfigBean.
+ *
+ * @param properties shenyu motan properties
+ * @return baseServiceConfig
+ */
+ @Bean
+ public BasicServiceConfigBean baseServiceConfig(final
ShenyuMotanProperties properties) {
+ BasicServiceConfigBean config = new BasicServiceConfigBean();
+ config.setExport(properties.getBasicServiceConfig().getExport());
+ config.setGroup(properties.getBasicServiceConfig().getGroup());
+ config.setAccessLog(properties.getBasicServiceConfig().isAccessLog());
+
config.setShareChannel(properties.getBasicServiceConfig().isShareChannel());
+ config.setModule(properties.getBasicServiceConfig().getModule());
+
config.setApplication(properties.getBasicServiceConfig().getApplication());
+ config.setRegistry(properties.getBasicServiceConfig().getRegistry());
+
config.setRequestTimeout(properties.getBasicServiceConfig().getRequestTimeout());
+ return config;
+ }
+
+ @Override
+ public void run(final ApplicationArguments args) throws Exception {
+
MotanSwitcherUtil.setSwitcherValue(MotanConstants.REGISTRY_HEARTBEAT_SWITCHER,
true);
+ }
Review Comment:
Can we set this switch as a configurable value to `ShenyuMotanConfig` ?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]