Exemple #1
0
        /// <summary>
        /// 增对不同的客户端和消息类型进行处理
        /// </summary>
        /// <param name="regClient"></param>
        /// <param name="regMessage"></param>
        public void Process(RegistryClient regClient, CometMessage regMessage)
        {
            if (regMessage.Action == CometMessageAction.Hello)
            {
                ConsumerConfig consumerConfig = XmlUtil.LoadObjFromXML <ConsumerConfig>(regMessage.MessageBody);
                regClient.ConsumerConfig        = consumerConfig;
                regClient.ProcessorID           = regMessage.ProcessorID;
                regClient.DotNetFramworkVersion = regMessage.DotNetFramworkVersion;
                regClient.OSVersion             = regMessage.OSVersion;
                regClient.ClientApplicationName = consumerConfig.ApplicationName;

                ESBConfig esbConfig = GetESBConfig(regClient);
                m_RegistryCenter.SendData(regClient, CometMessageAction.ServiceConfig, esbConfig.ToXml(), regMessage.IsAsync);
            }
            else if (regMessage.Action == CometMessageAction.ListRegistryClient)
            {
                String message = XmlUtil.SaveXmlFromObj <List <RegistryClient> >(m_RegistryCenter.RegistryClients);
                m_RegistryCenter.SendData(regClient, CometMessageAction.ListRegistryClient, message, regMessage.IsAsync);
            }
            else if (regMessage.Action == CometMessageAction.ResendConfig)//--管理中心向每个客户端发送配置文件
            {
                foreach (var item in m_RegistryCenter.RegistryClients)
                {
                    if (item.RegistryClientType == CometClientType.Consumer ||
                        item.RegistryClientType == CometClientType.CallCenter ||
                        item.RegistryClientType == CometClientType.Monitor ||
                        item.RegistryClientType == CometClientType.QueueCenter ||
                        item.RegistryClientType == CometClientType.Portal)
                    {
                        ESBConfig esbConfig = GetESBConfig(item);
                        m_RegistryCenter.SendData(item, CometMessageAction.ServiceConfig, esbConfig.ToXml());
                    }
                }
            }
        }
Exemple #2
0
 /// <summary>
 /// 增对不同的客户端和消息类型进行处理
 /// </summary>
 /// <param name="regClient"></param>
 /// <param name="regMessage"></param>
 public void Process(RegistryClient regClient, RegistryMessage regMessage)
 {
     if (regMessage.ClientType == RegistryClientType.Consumer && regMessage.Action == RegistryMessageAction.Hello)
     {
         ConsumerConfig consumerConfig = XmlUtil.LoadObjFromXML <ConsumerConfig>(regMessage.MessageBody);
         ESBConfig      esbConfig      = GetESBConfig(consumerConfig);
         m_RegistryCenter.SendData(regClient, RegistryMessageAction.ServiceConfig, esbConfig.ToXml());
     }
 }