Beispiel #1
0
        public void InsertSettingUri(SettingUri entity)
        {
            if (String.IsNullOrEmpty(entity.OID))
                entity.OID = Guid.NewGuid().ToString();

            entity.Insert();

            esbProxy.RegistryConsumerClient.ResendServiceConfig();
        }
        public void InsertSettingUri(SettingUri entity)
        {
            if (String.IsNullOrEmpty(entity.OID))
            {
                entity.OID = Guid.NewGuid().ToString();
            }

            entity.Insert();

            esbProxy.RegistryConsumerClient.ResendServiceConfig();
        }
Beispiel #3
0
        public void UpdateSettingUri(SettingUri entity)
        {
            if (entity.UserName == null)
                entity.UserName = String.Empty;

            if (entity.PassWord == null)
                entity.PassWord = String.Empty;

            entity.Update();
            esbProxy.RegistryConsumerClient.ResendServiceConfig();
        }
        public void UpdateSettingUri(SettingUri entity)
        {
            if (entity.UserName == null)
            {
                entity.UserName = String.Empty;
            }

            if (entity.PassWord == null)
            {
                entity.PassWord = String.Empty;
            }

            entity.Update();
            esbProxy.RegistryConsumerClient.ResendServiceConfig();
        }
        public void DeleteSettingUri(SettingUri entity)
        {
            entity.Delete();

            esbProxy.RegistryConsumerClient.ResendServiceConfig();
        }
 public List <SettingUri> GetAllSettingUri()
 {
     return(SettingUri.FindAll());
 }
Beispiel #7
0
        /// <summary>
        /// 获取到ESBConfig
        /// </summary>
        /// <returns></returns>
        private ESBConfig GetESBConfig(RegistryClient regClient)
        {
            ConsumerConfig consumerConfig = regClient.ConsumerConfig;
            ESBConfig      esbConfig      = new ESBConfig();

            //--处理中心地址
            foreach (SettingUri uri in SettingUri.FindAll())
            {
                switch (uri.UriType)
                {
                case 0:     //--注册中心
                    esbConfig.Registry.Add(new RegistryItem()
                    {
                        Uri = String.Format("{0}:{1}", uri.Uri, uri.Port), Load = 1
                    });
                    break;

                case 1:     //--监控中心
                    esbConfig.Monitor.Add(new MonitorItem()
                    {
                        Uri = String.Format("{0}:{1}", uri.Uri, uri.Port), Load = 1
                    });
                    break;

                case 2:     //--调用中心
                    esbConfig.CallCenter.Add(new CallCenterItem()
                    {
                        Uri = uri.Uri, Load = 1
                    });
                    break;

                case 3:     //--队列中心
                    esbConfig.MessageQueue.Add(new MessageQueueItem()
                    {
                        Uri = String.Format("{0}:{1}:{2}:{3}", uri.Uri, uri.Port, uri.UserName, uri.PassWord), Load = 1
                    });
                    break;

                case 4:     //--缓存中心
                    esbConfig.Cache.Add(new CacheItem()
                    {
                        Uri = String.Format("{0}:{1}", uri.Uri, uri.Port), Load = 1
                    });
                    break;

                default:
                    break;
                }
            }

            //--处理服务
            if (regClient.RegistryClientType == CometClientType.Consumer ||
                regClient.RegistryClientType == CometClientType.Portal ||
                regClient.RegistryClientType == CometClientType.Monitor)
            {
                foreach (var refService in consumerConfig.Reference)
                {
                    List <EsbView_ServiceVersion> lstBS = EsbView_ServiceVersion.FindAllPublish();
                    foreach (EsbView_ServiceVersion bs in lstBS.Where(x => x.ServiceName == refService.ServiceName))
                    {
                        ServiceItem si = new ServiceItem();
                        si.ServiceName = bs.ServiceName;
                        si.Version     = bs.BigVer;
                        si.Binding     = bs.Binding;
                        si.IsDefault   = (bs.BigVer == bs.DefaultVersion);

                        esbConfig.Service.Add(si);
                    }
                }
            }
            else if (regClient.RegistryClientType == CometClientType.CallCenter ||
                     regClient.RegistryClientType == CometClientType.QueueCenter)
            {
                EntityList <EsbView_ServiceVersion> lstBS = EsbView_ServiceVersion.FindAllPublish();
                foreach (var bs in lstBS)
                {
                    ServiceItem si = new ServiceItem();
                    si.ServiceName = bs.ServiceName;
                    si.Version     = bs.BigVer;
                    si.Binding     = bs.Binding;
                    si.IsDefault   = (bs.BigVer == bs.DefaultVersion);

                    esbConfig.Service.Add(si);
                }
            }

            //--处理服务配置
            if (regClient.RegistryClientType == CometClientType.Consumer ||
                regClient.RegistryClientType == CometClientType.Portal ||
                regClient.RegistryClientType == CometClientType.Monitor)
            {
                List <EsbView_ServiceConfig> lstSC = EsbView_ServiceConfig.FindAll();

                foreach (var refService in consumerConfig.Reference)
                {
                    List <EsbView_ServiceConfig> scs = lstSC.FindAll(x => x.ServiceName == refService.ServiceName);
                    foreach (EsbView_ServiceConfig sc in scs)
                    {
                        esbConfig.ServiceConfig.Add(sc);
                    }
                }
            }
            else if (regClient.RegistryClientType == CometClientType.CallCenter ||
                     regClient.RegistryClientType == CometClientType.QueueCenter)
            {
                esbConfig.ServiceConfig = EsbView_ServiceConfig.FindAll();
            }


            return(esbConfig);
        }
Beispiel #8
0
        public void DeleteSettingUri(SettingUri entity)
        {
            entity.Delete();

            esbProxy.RegistryConsumerClient.ResendServiceConfig();
        }