This commit is contained in:
redkale
2023-10-06 22:13:42 +08:00
parent 2e060cba45
commit 4351b74a91
2 changed files with 7 additions and 2 deletions

View File

@@ -1171,8 +1171,10 @@ public final class Application {
this.resourceFactory.inject(agent);
agent.init(agent.getConfig());
this.resourceFactory.register(agent.getName(), MessageAgent.class, agent);
this.resourceFactory.register(agent.getName(), HttpMessageClient.class, agent.getHttpMessageClient());
//this.resourceFactory.register(agent.getName(), SncpMessageClient.class, agent.getSncpMessageClient()); //不需要给开发者使用
if (this.clusterAgent == null) {
this.resourceFactory.register(agent.getName(), HttpMessageClient.class, agent.getHttpMessageClient());
//this.resourceFactory.register(agent.getName(), SncpMessageClient.class, agent.getSncpMessageClient()); //不需要给开发者使用
}
}
logger.info("MessageAgent init in " + (System.currentTimeMillis() - s) + " ms");
}

View File

@@ -171,6 +171,9 @@ public abstract class ClusterAgent {
}
protected boolean canRegister(NodeServer ns, String protocol, Service service) {
if (service.getClass().getAnnotation(Component.class) != null) {
return false;
}
if ("SNCP".equalsIgnoreCase(protocol) && service.getClass().getAnnotation(Local.class) != null) {
return false;
}