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/06/14 09:41:01 UTC

[GitHub] [shenyu] moremind commented on a diff in pull request #4735: [type:feat] Admin sync data

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


##########
shenyu-admin/src/main/java/org/apache/shenyu/admin/discovery/DiscoveryDataChangedEventSyncListener.java:
##########
@@ -0,0 +1,148 @@
+/*
+ * 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.discovery;
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.shenyu.admin.discovery.parse.KeyValueParser;
+import org.apache.shenyu.admin.mapper.DiscoveryUpstreamMapper;
+import org.apache.shenyu.admin.model.entity.DiscoveryUpstreamDO;
+import org.apache.shenyu.common.dto.DiscoverySyncData;
+import org.apache.shenyu.common.dto.DiscoveryUpstreamData;
+import org.apache.shenyu.common.dto.ProxySelectorData;
+import org.apache.shenyu.common.enums.ConfigGroupEnum;
+import org.apache.shenyu.common.enums.DataEventTypeEnum;
+import org.apache.shenyu.common.utils.UUIDUtils;
+import org.apache.shenyu.discovery.api.listener.DataChangedEvent;
+import org.apache.shenyu.discovery.api.listener.DataChangedEventListener;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeanUtils;
+import org.springframework.context.ApplicationEventPublisher;
+
+import java.sql.Timestamp;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+/**
+ * DiscoveryHandler.
+ */
+public class DiscoveryDataChangedEventSyncListener implements DataChangedEventListener {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(DiscoveryDataChangedEventSyncListener.class);
+
+    private final KeyValueParser keyValueParser;
+
+    private final ApplicationEventPublisher eventPublisher;
+
+    private final DiscoveryUpstreamMapper discoveryUpstreamMapper;
+
+    private final Boolean needPersistence;
+
+    public DiscoveryDataChangedEventSyncListener(final ApplicationEventPublisher eventPublisher,
+                                                 final DiscoveryUpstreamMapper discoveryUpstreamMapper,
+                                                 final KeyValueParser keyValueParser,
+                                                 final Boolean needPersistence) {
+        this.eventPublisher = eventPublisher;
+        this.keyValueParser = keyValueParser;
+        this.discoveryUpstreamMapper = discoveryUpstreamMapper;
+        this.needPersistence = needPersistence;
+    }
+
+    @Override
+    public void onChange(final DataChangedEvent event) {
+        DataChangedEvent.Event currentEvent = event.getEvent();
+        if (DataChangedEvent.Event.IGNORED.equals(currentEvent)) {
+            return;
+        }
+        DiscoverySyncData discoverySyncData = buildProxySelectorData(event.getKey(), event.getValue());
+        org.apache.shenyu.admin.listener.DataChangedEvent dataChangedEvent = null;
+        List<DiscoveryUpstreamData> upstreamDataList = discoverySyncData.getUpstreamDataList();
+        if (needPersistence) {
+            if (CollectionUtils.isEmpty(upstreamDataList)) {
+                LOGGER.warn("shenyu proxySelectorData#discoveryUpstreamList is empty");
+                return;
+            }
+            switch (currentEvent) {
+                case ADDED:
+                    upstreamDataList.forEach(d -> {
+                        DiscoveryUpstreamDO discoveryUpstreamDO = new DiscoveryUpstreamDO();
+                        BeanUtils.copyProperties(d, discoveryUpstreamDO);
+                        discoveryUpstreamDO.setId(UUIDUtils.getInstance().generateShortUuid());
+                        discoveryUpstreamDO.setDateCreated(new Timestamp(System.currentTimeMillis()));
+                        discoveryUpstreamDO.setDateUpdated(new Timestamp(System.currentTimeMillis()));
+                        discoveryUpstreamMapper.insert(discoveryUpstreamDO);
+                        LOGGER.info("shenyu [DiscoveryDataChangedEventSyncListener] ADDED Upstream {}", discoveryUpstreamDO.getUrl());
+                    });
+                    fillFullyDiscoverySyncData(discoverySyncData);
+                    dataChangedEvent = new org.apache.shenyu.admin.listener.DataChangedEvent(ConfigGroupEnum.PROXY_SELECTOR, DataEventTypeEnum.CREATE, Collections.singletonList(discoverySyncData));
+                    break;
+                case UPDATED:
+                    upstreamDataList.forEach(d -> {
+                        DiscoveryUpstreamDO discoveryUpstreamDO = new DiscoveryUpstreamDO();
+                        BeanUtils.copyProperties(d, discoveryUpstreamDO);
+                        discoveryUpstreamMapper.update(discoveryUpstreamDO);
+                        LOGGER.info("shenyu [DiscoveryDataChangedEventSyncListener] UPDATE Upstream {}", discoveryUpstreamDO.getUrl());
+                    });
+                    fillFullyDiscoverySyncData(discoverySyncData);
+                    dataChangedEvent = new org.apache.shenyu.admin.listener.DataChangedEvent(ConfigGroupEnum.PROXY_SELECTOR, DataEventTypeEnum.UPDATE, Collections.singletonList(discoverySyncData));
+                    break;
+                case DELETED:
+                    if (CollectionUtils.isNotEmpty(upstreamDataList)) {
+                        upstreamDataList.forEach(up -> {
+                            discoveryUpstreamMapper.deleteByUrl(up.getUrl());
+                            LOGGER.info("shenyu [DiscoveryDataChangedEventSyncListener] DELETE Upstream {}", up.getUrl());
+                        });
+                    }
+                    fillFullyDiscoverySyncData(discoverySyncData);
+                    dataChangedEvent = new org.apache.shenyu.admin.listener.DataChangedEvent(ConfigGroupEnum.PROXY_SELECTOR, DataEventTypeEnum.UPDATE, Collections.singletonList(discoverySyncData));
+                    break;
+                default:

Review Comment:
   not have default, or throw illegalException



##########
shenyu-admin/src/main/java/org/apache/shenyu/admin/discovery/DiscoveryDataChangedEventSyncListener.java:
##########
@@ -0,0 +1,148 @@
+/*
+ * 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.discovery;
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.shenyu.admin.discovery.parse.KeyValueParser;
+import org.apache.shenyu.admin.mapper.DiscoveryUpstreamMapper;
+import org.apache.shenyu.admin.model.entity.DiscoveryUpstreamDO;
+import org.apache.shenyu.common.dto.DiscoverySyncData;
+import org.apache.shenyu.common.dto.DiscoveryUpstreamData;
+import org.apache.shenyu.common.dto.ProxySelectorData;
+import org.apache.shenyu.common.enums.ConfigGroupEnum;
+import org.apache.shenyu.common.enums.DataEventTypeEnum;
+import org.apache.shenyu.common.utils.UUIDUtils;
+import org.apache.shenyu.discovery.api.listener.DataChangedEvent;
+import org.apache.shenyu.discovery.api.listener.DataChangedEventListener;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeanUtils;
+import org.springframework.context.ApplicationEventPublisher;
+
+import java.sql.Timestamp;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+/**
+ * DiscoveryHandler.
+ */
+public class DiscoveryDataChangedEventSyncListener implements DataChangedEventListener {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(DiscoveryDataChangedEventSyncListener.class);
+
+    private final KeyValueParser keyValueParser;
+
+    private final ApplicationEventPublisher eventPublisher;
+
+    private final DiscoveryUpstreamMapper discoveryUpstreamMapper;
+
+    private final Boolean needPersistence;
+
+    public DiscoveryDataChangedEventSyncListener(final ApplicationEventPublisher eventPublisher,
+                                                 final DiscoveryUpstreamMapper discoveryUpstreamMapper,
+                                                 final KeyValueParser keyValueParser,
+                                                 final Boolean needPersistence) {
+        this.eventPublisher = eventPublisher;
+        this.keyValueParser = keyValueParser;
+        this.discoveryUpstreamMapper = discoveryUpstreamMapper;
+        this.needPersistence = needPersistence;
+    }
+
+    @Override
+    public void onChange(final DataChangedEvent event) {
+        DataChangedEvent.Event currentEvent = event.getEvent();
+        if (DataChangedEvent.Event.IGNORED.equals(currentEvent)) {
+            return;
+        }
+        DiscoverySyncData discoverySyncData = buildProxySelectorData(event.getKey(), event.getValue());
+        org.apache.shenyu.admin.listener.DataChangedEvent dataChangedEvent = null;
+        List<DiscoveryUpstreamData> upstreamDataList = discoverySyncData.getUpstreamDataList();
+        if (needPersistence) {
+            if (CollectionUtils.isEmpty(upstreamDataList)) {
+                LOGGER.warn("shenyu proxySelectorData#discoveryUpstreamList is empty");
+                return;
+            }
+            switch (currentEvent) {
+                case ADDED:
+                    upstreamDataList.forEach(d -> {
+                        DiscoveryUpstreamDO discoveryUpstreamDO = new DiscoveryUpstreamDO();
+                        BeanUtils.copyProperties(d, discoveryUpstreamDO);
+                        discoveryUpstreamDO.setId(UUIDUtils.getInstance().generateShortUuid());
+                        discoveryUpstreamDO.setDateCreated(new Timestamp(System.currentTimeMillis()));
+                        discoveryUpstreamDO.setDateUpdated(new Timestamp(System.currentTimeMillis()));
+                        discoveryUpstreamMapper.insert(discoveryUpstreamDO);
+                        LOGGER.info("shenyu [DiscoveryDataChangedEventSyncListener] ADDED Upstream {}", discoveryUpstreamDO.getUrl());
+                    });
+                    fillFullyDiscoverySyncData(discoverySyncData);
+                    dataChangedEvent = new org.apache.shenyu.admin.listener.DataChangedEvent(ConfigGroupEnum.PROXY_SELECTOR, DataEventTypeEnum.CREATE, Collections.singletonList(discoverySyncData));
+                    break;
+                case UPDATED:
+                    upstreamDataList.forEach(d -> {
+                        DiscoveryUpstreamDO discoveryUpstreamDO = new DiscoveryUpstreamDO();
+                        BeanUtils.copyProperties(d, discoveryUpstreamDO);

Review Comment:
   same



##########
shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/AbstractListDataChangedListener.java:
##########
@@ -248,12 +249,14 @@ public void onRuleChanged(final List<RuleData> changed, final DataEventTypeEnum
         LOG.debug("[DataChangedListener] RuleChanged {}", changeData.getRuleDataId());
     }
 
+    // fixme: 12/6/2023 需要 验证 暂时只是 编译不报错了

Review Comment:
   remove this



##########
shenyu-admin/src/main/java/org/apache/shenyu/admin/discovery/DiscoveryDataChangedEventSyncListener.java:
##########
@@ -0,0 +1,148 @@
+/*
+ * 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.discovery;
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.shenyu.admin.discovery.parse.KeyValueParser;
+import org.apache.shenyu.admin.mapper.DiscoveryUpstreamMapper;
+import org.apache.shenyu.admin.model.entity.DiscoveryUpstreamDO;
+import org.apache.shenyu.common.dto.DiscoverySyncData;
+import org.apache.shenyu.common.dto.DiscoveryUpstreamData;
+import org.apache.shenyu.common.dto.ProxySelectorData;
+import org.apache.shenyu.common.enums.ConfigGroupEnum;
+import org.apache.shenyu.common.enums.DataEventTypeEnum;
+import org.apache.shenyu.common.utils.UUIDUtils;
+import org.apache.shenyu.discovery.api.listener.DataChangedEvent;
+import org.apache.shenyu.discovery.api.listener.DataChangedEventListener;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeanUtils;
+import org.springframework.context.ApplicationEventPublisher;
+
+import java.sql.Timestamp;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+/**
+ * DiscoveryHandler.
+ */
+public class DiscoveryDataChangedEventSyncListener implements DataChangedEventListener {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(DiscoveryDataChangedEventSyncListener.class);
+
+    private final KeyValueParser keyValueParser;
+
+    private final ApplicationEventPublisher eventPublisher;
+
+    private final DiscoveryUpstreamMapper discoveryUpstreamMapper;
+
+    private final Boolean needPersistence;
+
+    public DiscoveryDataChangedEventSyncListener(final ApplicationEventPublisher eventPublisher,
+                                                 final DiscoveryUpstreamMapper discoveryUpstreamMapper,
+                                                 final KeyValueParser keyValueParser,
+                                                 final Boolean needPersistence) {
+        this.eventPublisher = eventPublisher;
+        this.keyValueParser = keyValueParser;
+        this.discoveryUpstreamMapper = discoveryUpstreamMapper;
+        this.needPersistence = needPersistence;
+    }
+
+    @Override
+    public void onChange(final DataChangedEvent event) {
+        DataChangedEvent.Event currentEvent = event.getEvent();
+        if (DataChangedEvent.Event.IGNORED.equals(currentEvent)) {
+            return;
+        }
+        DiscoverySyncData discoverySyncData = buildProxySelectorData(event.getKey(), event.getValue());
+        org.apache.shenyu.admin.listener.DataChangedEvent dataChangedEvent = null;
+        List<DiscoveryUpstreamData> upstreamDataList = discoverySyncData.getUpstreamDataList();
+        if (needPersistence) {
+            if (CollectionUtils.isEmpty(upstreamDataList)) {
+                LOGGER.warn("shenyu proxySelectorData#discoveryUpstreamList is empty");
+                return;
+            }
+            switch (currentEvent) {
+                case ADDED:
+                    upstreamDataList.forEach(d -> {
+                        DiscoveryUpstreamDO discoveryUpstreamDO = new DiscoveryUpstreamDO();
+                        BeanUtils.copyProperties(d, discoveryUpstreamDO);

Review Comment:
   I sugguest use method instead of `BeanUtils.copyProperties` like SelectorData#transferDO



##########
shenyu-discovery/shenyu-discovery-zookeeper/src/main/java/org/apache/shenyu/discovery/zookeeper/ZookeeperDiscoveryService.java:
##########
@@ -112,59 +116,81 @@ private void createOrUpdate(final String key, final String value, final CreateMo
     @Override
     public void watcher(final String key, final DataChangedEventListener listener) {
         try {
-            this.client.getData().usingWatcher(new CuratorWatcher() {
-                @Override
-                public void process(final WatchedEvent watchedEvent) throws Exception {
-                    if (Objects.nonNull(listener)) {
-                        String path = Objects.isNull(watchedEvent.getPath()) ? "" : watchedEvent.getPath();
-                        if (StringUtils.isNoneBlank(path)) {
-                            client.getData().usingWatcher(this).forPath(path);
-                            byte[] ret = client.getData().forPath(key);
-                            String data = Objects.isNull(ret) ? null : new String(ret, StandardCharsets.UTF_8);
-                            LOGGER.info("shenyu ZookeeperDiscoveryService onChange key={}", path);
-                            listener.onChange(buildDataChangedEvent(path, data, watchedEvent));
-                        }
+            TreeCache treeCache = new TreeCache(client, key);
+            TreeCacheListener treeCacheListener = (curatorFramework, event) -> {
+                ChildData data = event.getData();
+                DataChangedEvent dataChangedEvent;
+                if (Objects.nonNull(data) && Objects.nonNull(data.getData())) {
+                    String currentPath = data.getPath();
+                    Stat stat = data.getStat();
+                    boolean isEphemeral = stat != null && stat.getEphemeralOwner() > 0;

Review Comment:
   use Objects.nonNull



##########
shenyu-admin/src/main/java/org/apache/shenyu/admin/discovery/DiscoveryDataChangedEventSyncListener.java:
##########
@@ -0,0 +1,148 @@
+/*
+ * 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.discovery;
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.shenyu.admin.discovery.parse.KeyValueParser;
+import org.apache.shenyu.admin.mapper.DiscoveryUpstreamMapper;
+import org.apache.shenyu.admin.model.entity.DiscoveryUpstreamDO;
+import org.apache.shenyu.common.dto.DiscoverySyncData;
+import org.apache.shenyu.common.dto.DiscoveryUpstreamData;
+import org.apache.shenyu.common.dto.ProxySelectorData;
+import org.apache.shenyu.common.enums.ConfigGroupEnum;
+import org.apache.shenyu.common.enums.DataEventTypeEnum;
+import org.apache.shenyu.common.utils.UUIDUtils;
+import org.apache.shenyu.discovery.api.listener.DataChangedEvent;
+import org.apache.shenyu.discovery.api.listener.DataChangedEventListener;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeanUtils;
+import org.springframework.context.ApplicationEventPublisher;
+
+import java.sql.Timestamp;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+/**
+ * DiscoveryHandler.
+ */
+public class DiscoveryDataChangedEventSyncListener implements DataChangedEventListener {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(DiscoveryDataChangedEventSyncListener.class);
+
+    private final KeyValueParser keyValueParser;
+
+    private final ApplicationEventPublisher eventPublisher;
+
+    private final DiscoveryUpstreamMapper discoveryUpstreamMapper;
+
+    private final Boolean needPersistence;
+
+    public DiscoveryDataChangedEventSyncListener(final ApplicationEventPublisher eventPublisher,
+                                                 final DiscoveryUpstreamMapper discoveryUpstreamMapper,
+                                                 final KeyValueParser keyValueParser,
+                                                 final Boolean needPersistence) {
+        this.eventPublisher = eventPublisher;
+        this.keyValueParser = keyValueParser;
+        this.discoveryUpstreamMapper = discoveryUpstreamMapper;
+        this.needPersistence = needPersistence;
+    }
+
+    @Override
+    public void onChange(final DataChangedEvent event) {
+        DataChangedEvent.Event currentEvent = event.getEvent();
+        if (DataChangedEvent.Event.IGNORED.equals(currentEvent)) {
+            return;
+        }
+        DiscoverySyncData discoverySyncData = buildProxySelectorData(event.getKey(), event.getValue());
+        org.apache.shenyu.admin.listener.DataChangedEvent dataChangedEvent = null;

Review Comment:
   use package



##########
shenyu-discovery/shenyu-discovery-zookeeper/src/main/java/org/apache/shenyu/discovery/zookeeper/ZookeeperDiscoveryService.java:
##########
@@ -112,59 +116,81 @@ private void createOrUpdate(final String key, final String value, final CreateMo
     @Override
     public void watcher(final String key, final DataChangedEventListener listener) {
         try {
-            this.client.getData().usingWatcher(new CuratorWatcher() {
-                @Override
-                public void process(final WatchedEvent watchedEvent) throws Exception {
-                    if (Objects.nonNull(listener)) {
-                        String path = Objects.isNull(watchedEvent.getPath()) ? "" : watchedEvent.getPath();
-                        if (StringUtils.isNoneBlank(path)) {
-                            client.getData().usingWatcher(this).forPath(path);
-                            byte[] ret = client.getData().forPath(key);
-                            String data = Objects.isNull(ret) ? null : new String(ret, StandardCharsets.UTF_8);
-                            LOGGER.info("shenyu ZookeeperDiscoveryService onChange key={}", path);
-                            listener.onChange(buildDataChangedEvent(path, data, watchedEvent));
-                        }
+            TreeCache treeCache = new TreeCache(client, key);
+            TreeCacheListener treeCacheListener = (curatorFramework, event) -> {
+                ChildData data = event.getData();
+                DataChangedEvent dataChangedEvent;
+                if (Objects.nonNull(data) && Objects.nonNull(data.getData())) {
+                    String currentPath = data.getPath();
+                    Stat stat = data.getStat();
+                    boolean isEphemeral = stat != null && stat.getEphemeralOwner() > 0;
+                    if (!isEphemeral) {
+                        LOGGER.info("shenyu Ignore non-ephemeral node changes");
+                        return;
+                    }
+                    switch (event.getType()) {
+                        case NODE_ADDED:
+                            dataChangedEvent = new DataChangedEvent(currentPath, new String(data.getData(), StandardCharsets.UTF_8), DataChangedEvent.Event.ADDED);
+                            break;
+                        case NODE_UPDATED:
+                            dataChangedEvent = new DataChangedEvent(currentPath, new String(data.getData(), StandardCharsets.UTF_8), DataChangedEvent.Event.UPDATED);
+                            break;
+                        case NODE_REMOVED:
+                            dataChangedEvent = new DataChangedEvent(currentPath, new String(data.getData(), StandardCharsets.UTF_8), DataChangedEvent.Event.DELETED);
+                            break;
+                        default:
+                            dataChangedEvent = new DataChangedEvent(currentPath, new String(data.getData(), StandardCharsets.UTF_8), DataChangedEvent.Event.IGNORED);
+                            break;
                     }
+                    listener.onChange(dataChangedEvent);
                 }
-            }).forPath(key);
+            };
+            treeCache.getListenable().addListener(treeCacheListener);

Review Comment:
   treeCache can use customize thread executor?



-- 
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