This commit is contained in:
@@ -127,9 +127,11 @@ public final class Application {
|
||||
final TransportFactory sncpTransportFactory;
|
||||
|
||||
//第三方服务发现管理接口
|
||||
//@since 2.1.0
|
||||
final ClusterAgent clusterAgent;
|
||||
|
||||
//MQ管理接口
|
||||
//@since 2.1.0
|
||||
final MessageAgent[] messageAgents;
|
||||
|
||||
//全局根ResourceFactory
|
||||
@@ -408,6 +410,14 @@ public final class Application {
|
||||
return clusterAgent;
|
||||
}
|
||||
|
||||
public MessageAgent getMessageAgent(String name) {
|
||||
if (messageAgents == null) return null;
|
||||
for (MessageAgent agent : messageAgents) {
|
||||
if (agent.getName().equals(name)) return agent;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public MessageAgent[] getMessageAgents() {
|
||||
return messageAgents;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import java.util.logging.Level;
|
||||
import javax.annotation.*;
|
||||
import static org.redkale.boot.Application.RESNAME_SNCP_ADDR;
|
||||
import org.redkale.boot.ClassFilter.FilterEntry;
|
||||
import org.redkale.mq.MessageAgent;
|
||||
import org.redkale.net.*;
|
||||
import org.redkale.net.http.*;
|
||||
import org.redkale.net.sncp.Sncp;
|
||||
@@ -226,7 +227,13 @@ public class NodeHttpServer extends NodeServer {
|
||||
|
||||
final String threadName = "[" + Thread.currentThread().getName() + "] ";
|
||||
final List<AbstractMap.SimpleEntry<String, String[]>> ss = sb == null ? null : new ArrayList<>();
|
||||
|
||||
String mqname = restConf.getValue("mq");
|
||||
MessageAgent agent0 = null;
|
||||
if (mqname != null) {
|
||||
agent0 = application.getMessageAgent(mqname);
|
||||
if (agent0 == null) throw new RuntimeException("not found " + MessageAgent.class.getSimpleName() + " config for (name=" + mqname + ")");
|
||||
}
|
||||
final MessageAgent agent = agent0;
|
||||
final boolean autoload = restConf.getBoolValue("autoload", true);
|
||||
{ //加载RestService
|
||||
String userTypeStr = restConf.getValue("usertype");
|
||||
|
||||
@@ -76,9 +76,6 @@ public abstract class NodeServer {
|
||||
//加载server节点后的拦截器
|
||||
protected NodeInterceptor interceptor;
|
||||
|
||||
//MQ管理
|
||||
protected MessageAgent messageAgent;
|
||||
|
||||
//供interceptor使用的Service对象集合
|
||||
protected final Set<Service> interceptorServices = new LinkedHashSet<>();
|
||||
|
||||
@@ -678,10 +675,6 @@ public abstract class NodeServer {
|
||||
return logger;
|
||||
}
|
||||
|
||||
public MessageAgent getMessageAgent() {
|
||||
return messageAgent;
|
||||
}
|
||||
|
||||
public String getSncpGroup() {
|
||||
return sncpGroup;
|
||||
}
|
||||
|
||||
@@ -36,10 +36,6 @@ public class NodeSncpServer extends NodeServer {
|
||||
}
|
||||
|
||||
public static NodeServer createNodeServer(Application application, AnyValue serconf) {
|
||||
if (serconf != null && serconf.getAnyValue("rest") != null) {
|
||||
((AnyValue.DefaultAnyValue) serconf).addValue("_$sncp", "true");
|
||||
return new NodeHttpServer(application, serconf);
|
||||
}
|
||||
return new NodeSncpServer(application, serconf);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @author zhangjx
|
||||
*
|
||||
* @since 2.1.0
|
||||
*/
|
||||
@Inherited
|
||||
@Documented
|
||||
|
||||
Reference in New Issue
Block a user