-
Notifications
You must be signed in to change notification settings - Fork 642
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ISSUE #4931]Add Registry Module for Discovery AdminServer
- Loading branch information
Showing
10 changed files
with
177 additions
and
126 deletions.
There are no files selected for viewing
14 changes: 0 additions & 14 deletions
14
...sh-registry-api/src/main/java/org/apache/eventmesh/registry/AbstractRegistryListener.java
This file was deleted.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
...istry/eventmesh-registry-api/src/main/java/org/apache/eventmesh/registry/NotifyEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package org.apache.eventmesh.registry; | ||
|
||
import lombok.Getter; | ||
|
||
import java.util.List; | ||
|
||
public class NotifyEvent { | ||
|
||
public NotifyEvent(){ | ||
|
||
} | ||
|
||
public NotifyEvent(List<RegisterServerInfo> instances) { | ||
this(instances, false); | ||
} | ||
|
||
public NotifyEvent(List<RegisterServerInfo> instances, boolean isIncrement) { | ||
this.isIncrement = isIncrement; | ||
this.instances = instances; | ||
} | ||
|
||
|
||
|
||
// means whether it is an increment data | ||
@Getter | ||
private boolean isIncrement; | ||
|
||
@Getter | ||
private List<RegisterServerInfo> instances; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 0 additions & 76 deletions
76
...registry/eventmesh-registry-api/src/main/java/org/apache/eventmesh/registry/Registry.java
This file was deleted.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
...y/eventmesh-registry-api/src/main/java/org/apache/eventmesh/registry/RegistryFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.apache.eventmesh.registry; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
import org.apache.eventmesh.spi.EventMeshExtensionFactory; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
@Slf4j | ||
public class RegistryFactory { | ||
private static final Map<String, RegistryService> META_CACHE = new HashMap<>(16); | ||
|
||
public static RegistryService getInstance(String registryPluginType) { | ||
return META_CACHE.computeIfAbsent(registryPluginType, RegistryFactory::registryBuilder); | ||
} | ||
|
||
private static RegistryService registryBuilder(String registryPluginType) { | ||
RegistryService registryServiceExt = EventMeshExtensionFactory.getExtension(RegistryService.class, registryPluginType); | ||
if (registryServiceExt == null) { | ||
String errorMsg = "can't load the registry plugin, please check."; | ||
log.error(errorMsg); | ||
throw new RuntimeException(errorMsg); | ||
} | ||
log.info("build registry plugin [{}] by type [{}] success", registryServiceExt.getClass().getSimpleName(), | ||
registryPluginType); | ||
return registryServiceExt; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
.../eventmesh-registry-api/src/main/java/org/apache/eventmesh/registry/RegistryListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
package org.apache.eventmesh.registry; | ||
|
||
public interface RegistryListener { | ||
void onChange(Object data); | ||
void onChange(NotifyEvent event) throws Exception; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.