Exemplo n.º 1
0
        /// <summary>
        /// 获取到ESBConfig
        /// </summary>
        /// <returns></returns>
        private ESBConfig GetESBConfig(ConsumerConfig consumerConfig)
        {
            ESBConfig esbConfig = new ESBConfig();
            esbConfig.Service.Add(new ServiceItem() { ServiceName = "ESB_ASHX", DirectInvokeEnabled = true, Uri = "http://esb.jn.com" });


            return esbConfig;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 构造器
        /// </summary>
        public RabbitQueueManager()
        {
            m_EsbConfig = m_ESBProxy.RegistryConsumerClient.ESBConfig;
            m_ConsumerConfig = m_ESBProxy.RegistryConsumerClient.ConsumerConfig;
            m_QueueThreadDict = new Dictionary<String, QueueThread>();
            
            if (m_EsbConfig != null && m_EsbConfig.MessageQueue.Count > 0)
            {
                //String esbQueue = Config.GetConfig<String>("ESB.Queue");
                String esbQueue = m_EsbConfig.MessageQueue[0].Uri;
                XTrace.WriteLine("读取到ESB队列地址:{0}", esbQueue);

                m_ParamMQ = esbQueue.Split(':');
            }
            else
            {
                String err = "无法获取到有效的队列地址!";
                XTrace.WriteLine(err);
                throw new Exception(err);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// 删除一个服务引用并异步序列化到磁盘
 /// </summary>
 /// <param name="serviceName"></param>
 /// <param name="consumerConfig"></param>
 public void RemoveReference(String serviceName, ConsumerConfig consumerConfig)
 {
     ReferenceItem refItem = consumerConfig.Reference.Find(x => x.ServiceName == serviceName);
     if (refItem != null)
     {
         consumerConfig.Reference.Remove(refItem);
         ThreadPoolX.QueueUserWorkItem(x =>
         {
             m_ConfigurationManager.SaveConsumerConfig(consumerConfig);
         });
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// 将消费者配置文件写入磁盘
 /// </summary>
 /// <param name="consumerConfig"></param>
 public void SaveConsumerConfig(ConsumerConfig consumerConfig)
 {
     File.WriteAllText(ConsumerConfigPath, XmlUtil.SaveXmlFromObj<ConsumerConfig>(consumerConfig));
 }
Exemplo n.º 5
0
 /// <summary>
 /// 将消费者配置文件写入磁盘
 /// </summary>
 /// <param name="consumerConfig"></param>
 public void SaveConsumerConfig(ConsumerConfig consumerConfig)
 {
     File.WriteAllText(ConsumerConfigPath, XmlUtil.SaveXmlFromObj <ConsumerConfig>(consumerConfig));
 }
Exemplo n.º 6
0
        /// <summary>
        /// 加载配置文件:加载本地配置文件ConsumerConfig->ESBConfig
        /// </summary>
        private void LoadConfig()
        {
            m_ConfigurationManager = ConfigurationManager.GetInstance();
            m_ConsumerConfig = m_ConfigurationManager.LoadConsumerConfig();
            m_ESBConfig = m_ConfigurationManager.LoadESBConfig();

            if (m_ConsumerConfig == null)
                throw new Exception("缺少有效的消费者配置文件ConsumerConfig.xml。");

            if (m_ESBConfig == null)
                Status = ESBProxyStatus.LostESBConfig;
            else
                Status = ESBProxyStatus.Ready;
        }