Beispiel #1
0
        /// <summary>
        /// 初始化客户端代理
        /// </summary>
        private void Init()
        {
            if (m_Inited > 0 || Interlocked.CompareExchange(ref m_Inited, 1, 0) > 0)
            {
                return;
            }

            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();

            //--STEP.1.记录客户端版本信息
            Status = ESBProxyStatus.Init;
            var asm = AssemblyX.Create(System.Reflection.Assembly.GetExecutingAssembly());

            Version = String.Format("{0} v{1} Build {2:yyyy-MM-dd HH:mm:ss}", asm.Name, asm.FileVersion, asm.Compile);
            XTrace.WriteLine(Version);

            //--STEP.2.加载配置文件
            LoadConfig();

            //--STEP.3.连接注册中心
            m_RegistryClient = new RegistryConsumerClient(this);
            m_RegistryClient.Connect();

            //--STEP.4.连接队列中心
            m_MessageQueueClient = new MessageQueueClient(this);
            m_MessageQueueClient.ConnectAsync();

            //--STEP.5.连接缓存中心
            m_CacheManager = new CacheManager(this);
            m_CacheManager.ConnectAsync();


            stopWatch.Stop();
            XTrace.WriteLine("ESBProxy Init 耗时:{0}ms。", stopWatch.ElapsedMilliseconds);;
        }
Beispiel #2
0
 /// <summary>
 /// ESBProxy构造函数
 /// </summary>
 private ESBProxy()
 {
     LoadConfig();
     m_RegistryClient = new RegistryConsumerClient(this);
     m_RegistryClient.Connect();
 }