Beispiel #1
0
        /// <summary>
        /// 初始化服务总线(使用WCF服务)
        /// </summary>
        public static void InitializeRemoteBus()
        {
            bizbus = new RemoteBizBus();
            RemoteBizBus     rbizbus    = bizbus as RemoteBizBus;
            string           configuri  = AppSettingConfig.getRemoteUriPath() + "Config";
            string           configPath = AppSettingConfig.getLocalConfigPath();
            BasicHttpBinding bhb        = new BasicHttpBinding("BasicHttpBinding_Service");
            EndpointAddress  epa        = new EndpointAddress(configuri);
            IHostConfig      hostconfig = ChannelFactory <IHostConfig> .CreateChannel(bhb, epa);

            XmlDocument doc = new XmlDocument();

            if (string.IsNullOrEmpty(configPath))
            {
                string configstring = hostconfig.GetConfigString();
                doc.LoadXml(configstring);
            }
            //else
            //{
            //    string file = AppDomain.CurrentDomain.BaseDirectory + @"\namespace DrectSoft.FrameWork.Config";
            //    doc.Load(file);
            //}

            List <ServicePackageInfo> packages = ConfigLoader.GetPackageList(doc.DocumentElement);

            rbizbus.packages = packages;
        }
Beispiel #2
0
        /// <summary>
        /// 初始化服务总线(本地调用不走WCF服务)
        /// </summary>
        public static void InitializeClientBus()
        {
            if (bizbus == null)
            {
                bizbus = new ClientBizBus();
            }

            ClientBizBus cbizbus = bizbus as ClientBizBus;

            List <ServicePackageInfo> packageinfos = ConfigLoader.GetPackageList();
            ServicePackageLoader      loader       = new ServicePackageLoader();
            ServicePackageList        packages     = new ServicePackageList();

            foreach (ServicePackageInfo info in packageinfos)
            {
                IServicePackage package = PackageConverter.Convert2Package(info);
                if (package == null)
                {
                    continue;
                }
                packages.Add(package);
            }
            cbizbus.packages = packages;
            cbizbus.IndexPackage();
        }