Skip to content

Commit

Permalink
add filters
Browse files Browse the repository at this point in the history
  • Loading branch information
xwm1992 committed Nov 13, 2023
1 parent d077d0f commit d76cc61
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,10 @@ default EventMeshAppSubTopicInfo findEventMeshAppSubTopicInfoByGroup(String grou
default List<EventMeshServicePubTopicInfo> findEventMeshServicePubTopicInfos() throws MetaException {
return Collections.emptyList();
}

/**
* addListener
* @param metaServiceListener used for notify when config changed if needed
*/
void addMetaServiceListener(MetaServiceListener<String, String> metaServiceListener);
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import org.apache.eventmesh.api.exception.MetaException;
import org.apache.eventmesh.api.meta.MetaService;
import org.apache.eventmesh.api.meta.MetaServiceListener;
import org.apache.eventmesh.api.meta.dto.EventMeshDataInfo;
import org.apache.eventmesh.api.meta.dto.EventMeshRegisterInfo;
import org.apache.eventmesh.api.meta.dto.EventMeshUnRegisterInfo;
Expand Down Expand Up @@ -66,6 +67,8 @@ public class ConsulMetaService implements MetaService {

private ConsulTLSConfig tlsConfig;

private MetaServiceListener<String, String> metaServiceListener;

@Override
public void init() throws MetaException {
if (initStatus.compareAndSet(false, true)) {
Expand Down Expand Up @@ -162,6 +165,11 @@ public boolean unRegister(EventMeshUnRegisterInfo eventMeshUnRegisterInfo) throw
return true;
}

@Override
public void addMetaServiceListener(MetaServiceListener<String, String> metaServiceListener) {
this.metaServiceListener = metaServiceListener;
}

@Override
public List<EventMeshDataInfo> findEventMeshInfoByCluster(String clusterName) throws MetaException {
HealthServicesRequest request = HealthServicesRequest.newBuilder().setPassing(true).setToken(token).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import org.apache.eventmesh.api.exception.MetaException;
import org.apache.eventmesh.api.meta.MetaService;
import org.apache.eventmesh.api.meta.MetaServiceListener;
import org.apache.eventmesh.api.meta.bo.EventMeshAppSubTopicInfo;
import org.apache.eventmesh.api.meta.bo.EventMeshServicePubTopicInfo;
import org.apache.eventmesh.api.meta.dto.EventMeshDataInfo;
Expand All @@ -40,6 +41,8 @@ public class MetaStorage {

private MetaService metaService;

private MetaServiceListener<String, String> metaServiceListener;

private final AtomicBoolean inited = new AtomicBoolean(false);

private final AtomicBoolean started = new AtomicBoolean(false);
Expand Down Expand Up @@ -128,4 +131,12 @@ public List<EventMeshServicePubTopicInfo> findEventMeshServicePubTopicInfos() th
public EventMeshAppSubTopicInfo findEventMeshAppSubTopicInfo(String group) throws Exception {
return metaService.findEventMeshAppSubTopicInfoByGroup(group);
}

public MetaServiceListener<String, String> getMetaServiceListener() {
return metaServiceListener;
}

public void setMetaServiceListener(MetaServiceListener<String, String> metaServiceListener) {
this.metaServiceListener = metaServiceListener;
}
}

0 comments on commit d76cc61

Please sign in to comment.