Exemplo n.º 1
0
        /// <summary>
        /// 通过端口初始化服务器
        /// </summary>
        /// <param name="port">端口</param>
        /// <returns>消息中间件服务器对象</returns>
        public static MQMServer InitServer(int port = 3033)
        {
            MQMServer appServer  = new MQMServer();
            var       listenners = new List <IListenerConfig>();

            listenners.Add(new ListenerConfig()
            {
                Ip = "IPv6Any", Port = port
            });
            listenners.Add(new ListenerConfig()
            {
                Ip = "Any", Port = port
            });

            ServerConfig config = new ServerConfig()
            {
                Listeners = listenners
            };

            if (!appServer.Setup(config)) //Setup with listening port
            {
                throw new Exception("Failed to setup!");
            }
            if (!appServer.Start())
            {
                throw new Exception("Failed to start!");
            }
            return(appServer);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 初始化消息队列代理器
        /// </summary>
        /// <param name="server"></param>
        public MessageQueueAgent(MQMServer server)
        {
            Server  = server;
            Logger  = LogManager.GetLogger(GetType());
            Adapter = new RedisMessageQueueAdapter();
            Storage = new DefaultMesssageQueueMiddlewareStorage();

            var subscribeItems = Storage.GetSubscribeItems(AgentId);//重载订阅数据,并进行远程订阅

            Storage.RemoveRemoteSubscribe(AgentId, null);
            foreach (var item in subscribeItems)
            {
                var group = item.Descriptions.GetGroup();
                if (!string.IsNullOrEmpty(group))
                {
                    RemoteSubscribe(group);//处理远程订阅
                }
            }

            RetryRemotePushFailure();
        }
 public SockectClientChannel(MQMServer server, string sessionId, ILog logger)
 {
     Server    = server;
     SessionId = sessionId;
     Logger    = logger;
 }
Exemplo n.º 4
0
 public SendToClientChannel(MQMServer server, ILog logger)
 {
     Server = server;
     Logger = logger;
 }