moremind commented on code in PR #5544:
URL: https://github.com/apache/shenyu/pull/5544#discussion_r1640234458


##########
shenyu-admin/pom.xml:
##########
@@ -84,6 +84,11 @@
             <artifactId>spring-integration-jdbc</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>org.springframework.integration</groupId>
+            <artifactId>spring-integration-zookeeper</artifactId>

Review Comment:
   this is should provided?



##########
shenyu-admin/src/main/java/org/apache/shenyu/admin/config/ClusterConfiguration.java:
##########
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.admin.config;
+
+import org.apache.shenyu.admin.config.properties.ClusterProperties;
+import org.apache.shenyu.admin.config.properties.ClusterZookeeperProperties;
+import org.apache.shenyu.admin.mode.ShenyuRunningModeService;
+import org.apache.shenyu.admin.mode.cluster.filter.ClusterForwardFilter;
+import org.apache.shenyu.admin.mode.cluster.service.ClusterSelectMasterService;
+import org.apache.shenyu.admin.mode.cluster.service.ShenyuClusterService;
+import org.apache.shenyu.admin.service.impl.UpstreamCheckService;
+import org.apache.shenyu.admin.service.manager.LoadServiceDocEntry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
+import 
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import 
org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * The type Cluster configuration.
+ */
+@Configuration(proxyBeanMethods = false)
+@EnableConfigurationProperties({ClusterProperties.class, 
ClusterZookeeperProperties.class})
+public class ClusterConfiguration {
+    
+    private static final Logger LOGGER = 
LoggerFactory.getLogger(ClusterConfiguration.class);
+    
+    @Value("${server.servlet.context-path:}")
+    private String contextPath;
+    
+    @Value("${server.port:}")
+    private String port;
+    
+//    /**
+//     * Shenyu Admin distributed lock by spring-integration-zookeeper.
+//     *
+//     * @param lockRepository the lockRepository
+//     * @return the shenyu Admin register repository
+//     */
+//    @Bean
+//    public ZookeeperLockRegistry zookeeperLockRegistry(final LockRepository 
lockRepository) {
+//        return new ZookeeperLockRegistry(lockRepository);
+//    }
+    
+    /**
+     * Shenyu running mode cluster service.
+     *
+     * @param shenyuClusterSelectMasterService shenyu cluster select master 
service
+     * @param upstreamCheckService upstream check service
+     * @param loadServiceDocEntry load service doc entry
+     * @param clusterProperties cluster properties
+     * @return Shenyu cluster service
+     */
+    @Bean(destroyMethod = "shutdown")
+    @ConditionalOnProperty(value = {"shenyu.cluster.enabled"}, havingValue = 
"true", matchIfMissing = true)

Review Comment:
   may should same as `clusterForwardFilter`?



##########
shenyu-admin/src/main/java/org/apache/shenyu/admin/config/ClusterJdbcConfiguration.java:
##########
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.admin.config;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shenyu.admin.config.properties.ClusterProperties;
+import org.apache.shenyu.admin.config.properties.ClusterZookeeperProperties;
+import 
org.apache.shenyu.admin.mode.cluster.impl.jdbc.ClusterSelectMasterServiceJdbcImpl;
+import 
org.apache.shenyu.admin.mode.cluster.impl.jdbc.mapper.ClusterMasterMapper;
+import org.apache.shenyu.admin.mode.cluster.service.ClusterSelectMasterService;
+import org.apache.shenyu.common.utils.IpUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import 
org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.integration.jdbc.lock.DefaultLockRepository;
+import org.springframework.integration.jdbc.lock.JdbcLockRegistry;
+import org.springframework.integration.jdbc.lock.LockRepository;
+
+import javax.sql.DataSource;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * The type Cluster jdbc configuration.
+ */
+@Configuration(proxyBeanMethods = false)
+@EnableConfigurationProperties({ClusterProperties.class, 
ClusterZookeeperProperties.class})
+@ConditionalOnProperty(value = {"shenyu.cluster.select-type"}, havingValue = 
"jdbc", matchIfMissing = true)

Review Comment:
   just use shenyu.cluster.type



-- 
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-unsubscr...@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to