diff --git a/eventmesh-meta/eventmesh-meta-nacos/src/main/java/org/apache/eventmesh/meta/nacos/service/NacosMetaService.java b/eventmesh-meta/eventmesh-meta-nacos/src/main/java/org/apache/eventmesh/meta/nacos/service/NacosMetaService.java index 438cba71ff..97ca1a92cb 100644 --- a/eventmesh-meta/eventmesh-meta-nacos/src/main/java/org/apache/eventmesh/meta/nacos/service/NacosMetaService.java +++ b/eventmesh-meta/eventmesh-meta-nacos/src/main/java/org/apache/eventmesh/meta/nacos/service/NacosMetaService.java @@ -297,7 +297,7 @@ public Map getMetaData(String key, boolean fuzzyEnabled) { private Map getResultFromNacos(int pageNo, int pageSize, String key, String group) { Map result = new HashMap<>(); try (CloseableHttpClient httpclient = HttpClients.createDefault()) { - URI uri = new URIBuilder(serverAddr + "/nacos/v1/cs/configs") + URI uri = new URIBuilder("http://" + serverAddr + "/nacos/v1/cs/configs") .setParameter("dataId", key) .setParameter("group", group) .setParameter("pageNo", String.valueOf(pageNo)) diff --git a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/EventMeshHTTPServer.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/EventMeshHTTPServer.java index 240881e228..f7e5be81f8 100644 --- a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/EventMeshHTTPServer.java +++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/EventMeshHTTPServer.java @@ -136,7 +136,6 @@ public void init() throws Exception { producerManager.init(); filterEngine = new FilterEngine(metaStorage, producerManager, consumerManager); - filterEngine.init(); super.setHandlerService(new HandlerService()); super.getHandlerService().setMetrics(this.getMetrics()); @@ -161,6 +160,10 @@ public void start() throws Exception { consumerManager.start(); producerManager.start(); httpRetryer.start(); + // filterEngine depend on metaStorage + if (metaStorage.getStarted().get()) { + filterEngine.start(); + } if (eventMeshHttpConfiguration.isEventMeshServerMetaStorageEnable()) { this.register(); diff --git a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/FilterEngine.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/FilterEngine.java index b3b88442e8..50b5444fcd 100644 --- a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/FilterEngine.java +++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/FilterEngine.java @@ -68,7 +68,7 @@ public FilterEngine(MetaStorage metaStorage, ProducerManager producerManager, Co this.consumerManager = consumerManager; } - public void init() { + public void start() { Map filterMetaData = metaStorage.getMetaData(FILTER_PREIX, true); for (Entry filterDataEntry : filterMetaData.entrySet()) { // filter-group diff --git a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/meta/MetaStorage.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/meta/MetaStorage.java index e2a1670e01..c497f03f14 100644 --- a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/meta/MetaStorage.java +++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/meta/MetaStorage.java @@ -138,4 +138,11 @@ public void getMetaDataWithListener(MetaServiceListener metaServiceListener, Str metaService.getMetaDataWithListener(metaServiceListener, key); } + public AtomicBoolean getInited() { + return inited; + } + + public AtomicBoolean getStarted() { + return started; + } }