Skip to content

Commit

Permalink
update filterEngine
Browse files Browse the repository at this point in the history
  • Loading branch information
xwm1992 committed Nov 23, 2023
1 parent 1bc96bd commit e6fc846
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ public Map<String, String> getMetaData(String key, boolean fuzzyEnabled) {
private Map<String, String> getResultFromNacos(int pageNo, int pageSize, String key, String group) {
Map<String, String> 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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public FilterEngine(MetaStorage metaStorage, ProducerManager producerManager, Co
this.consumerManager = consumerManager;
}

public void init() {
public void start() {
Map<String, String> filterMetaData = metaStorage.getMetaData(FILTER_PREIX, true);
for (Entry<String, String> filterDataEntry : filterMetaData.entrySet()) {
// filter-group
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,11 @@ public void getMetaDataWithListener(MetaServiceListener metaServiceListener, Str
metaService.getMetaDataWithListener(metaServiceListener, key);
}

public AtomicBoolean getInited() {
return inited;
}

public AtomicBoolean getStarted() {
return started;
}
}

0 comments on commit e6fc846

Please sign in to comment.