Skip to content

Commit

Permalink
support enabled registry plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
sodaRyCN committed May 23, 2024
1 parent b3ac90b commit d971f1f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,22 +76,28 @@ public void reportHeartbeat(ReportHeartBeatRequest heartBeat) {
@Override
@PostConstruct
public void start() {

registryService.init();
if (configuration.isEventMeshRegistryPluginEnabled()) {
registryService.init();
}
}

@Override
public void destroy() {
registryService.unRegister(adminServeInfo);
try {
Thread.sleep(3000);
}catch (InterruptedException ignore){}
registryService.shutdown();
if (configuration.isEventMeshRegistryPluginEnabled()) {
registryService.unRegister(adminServeInfo);
try {
Thread.sleep(3000);
} catch (InterruptedException ignore) {
}
registryService.shutdown();
}
}

@Override
public void onApplicationEvent(ApplicationReadyEvent event) {
log.info("application is started, it's will register admin self");
registryService.register(adminServeInfo);
if (configuration.isEventMeshRegistryPluginEnabled()) {
log.info("application is started and registry plugin is enabled, it's will register admin self");
registryService.register(adminServeInfo);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ public class CommonConfiguration {
@ConfigField(field = "registry.plugin.password")
private String eventMeshRegistryPluginPassword = "";

@ConfigField(field = "registry.plugin.enabled")
private boolean eventMeshRegistryPluginEnabled = false;

public void reload() {
this.eventMeshWebhookOrigin = "eventmesh." + eventMeshIDC;

Expand Down

0 comments on commit d971f1f

Please sign in to comment.