diff --git a/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/websocket/WebsocketCollector.java b/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/websocket/WebsocketCollector.java index 69bc1de26d4f..abe201a92af3 100644 --- a/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/websocket/WebsocketCollector.java +++ b/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/websocket/WebsocketCollector.java @@ -162,7 +162,8 @@ public void onMessage(final String message, final Session session) { if (Objects.equals(message, DataEventTypeEnum.MYSELF.name())) { try { ThreadLocalUtils.put(SESSION_KEY, session); - SpringBeanUtils.getInstance().getBean(SyncDataService.class).syncAll(DataEventTypeEnum.MYSELF); + String namespaceId = getNamespaceId(session); + SpringBeanUtils.getInstance().getBean(SyncDataService.class).syncAllByNamespaceId(DataEventTypeEnum.MYSELF, namespaceId); } finally { ThreadLocalUtils.clear(); } diff --git a/shenyu-admin/src/main/resources/mappers/namespace-plugin-rel-sqlmap.xml b/shenyu-admin/src/main/resources/mappers/namespace-plugin-rel-sqlmap.xml index 14421f49a444..10cab612b5f9 100644 --- a/shenyu-admin/src/main/resources/mappers/namespace-plugin-rel-sqlmap.xml +++ b/shenyu-admin/src/main/resources/mappers/namespace-plugin-rel-sqlmap.xml @@ -265,6 +265,7 @@ p.plugin_jar AS pluginJar FROM namespace_plugin_rel npr LEFT JOIN plugin p ON p.id = npr.plugin_id + WHERE npr.namespace_id = #{namespaceId, jdbcType=VARCHAR} ORDER BY sort, npr.id ASC diff --git a/shenyu-sync-data-center/shenyu-sync-data-websocket/src/main/java/org/apache/shenyu/plugin/sync/data/websocket/client/ShenyuWebsocketClient.java b/shenyu-sync-data-center/shenyu-sync-data-websocket/src/main/java/org/apache/shenyu/plugin/sync/data/websocket/client/ShenyuWebsocketClient.java index 309e54681119..33ffce38d91e 100644 --- a/shenyu-sync-data-center/shenyu-sync-data-websocket/src/main/java/org/apache/shenyu/plugin/sync/data/websocket/client/ShenyuWebsocketClient.java +++ b/shenyu-sync-data-center/shenyu-sync-data-websocket/src/main/java/org/apache/shenyu/plugin/sync/data/websocket/client/ShenyuWebsocketClient.java @@ -117,7 +117,7 @@ public ShenyuWebsocketClient(final URI serverUri, final Map head final String namespaceId) { super(serverUri, headers); this.namespaceId = namespaceId; - LOG.info("shenyu bootstrap websocket namespaceId:{}", namespaceId); + LOG.info("shenyu bootstrap websocket namespaceId: {}", namespaceId); this.addHeader(Constants.SHENYU_NAMESPACE_ID, namespaceId); this.websocketDataHandler = new WebsocketDataHandler(pluginDataSubscriber, metaDataSubscribers, authDataSubscribers, proxySelectorDataSubscribers, discoveryUpstreamDataSubscribers); this.timer = WheelTimerFactory.getSharedTimer();