Exemple #1
0
 public void UnSubscribe(string ServerIdentify, string publishServiceName)
 {
     PublisherManage.UnSubscribe(ServerIdentify, publishServiceName);
 }
Exemple #2
0
        //public void RegisterRemotePlugin(string ServerIdentify, string[] plugin)
        //{
        //    //客户端回调
        //    IDataReply callback = OperationContext.Current.GetCallbackChannel<IDataReply>();
        //    RemotePluginManage.RegisterRemotePlugin(callback, ServerIdentify, plugin);
        //}

        public void Subscribe(string ServerIdentify, string publishServiceName)
        {
            IDataReply callback = OperationContext.Current.GetCallbackChannel <IDataReply>();

            PublisherManage.Subscribe(ServerIdentify, publishServiceName, callback);
        }
Exemple #3
0
 private static void GetAllConfig()
 {
     #region 收集配置信息
     Action <HostRunConfigSubject> psAction = ((HostRunConfigSubject subject) =>
     {
         MNodePlugin nodeP = RemotePluginManage.GetLocalPlugin();
         if (nodeP != null)
         {
             HostRunConfigObject configObj;
             foreach (var p in nodeP.RemotePlugin)
             {
                 configObj = new HostRunConfigObject();
                 configObj.Label = "远程插件";
                 configObj.Key = p.PluginName;
                 configObj.Value = p.PluginName;
                 configObj.Memo = p.PluginName + "\t" + String.Join(",", p.MNodeIdentify.ToArray());
                 subject.ConfigObjList.Add(configObj);
             }
         }
     });
     Action <HostRunConfigSubject> pubsAction = ((HostRunConfigSubject subject) =>
     {
         if (PublisherManage.GetPublishServiceList() != null)
         {
             HostRunConfigObject configObj;
             foreach (var p in PublisherManage.GetPublishServiceList())
             {
                 configObj = new HostRunConfigObject();
                 configObj.Label = "发布服务";
                 configObj.Key = p.publishServiceName;
                 configObj.Value = p.publishServiceName;
                 configObj.Memo = p.publishServiceName + "\t" + p.explain;
                 subject.ConfigObjList.Add(configObj);
             }
         }
     });
     Action <HostRunConfigSubject> subsAction = ((HostRunConfigSubject subject) =>
     {
         if (SubscriberManager.GetSubscribeService() != null)
         {
             HostRunConfigObject configObj;
             foreach (var p in SubscriberManager.GetSubscribeService())
             {
                 configObj = new HostRunConfigObject();
                 configObj.Label = "订阅服务";
                 configObj.Key = p.publishServiceName;
                 configObj.Value = p.publishServiceName;
                 configObj.Memo = p.publishServiceName;
                 subject.ConfigObjList.Add(configObj);
             }
         }
     });
     Action <HostRunConfigSubject> taskAction = ((HostRunConfigSubject subject) =>
     {
         if (MiddlewareTask.TaskConfigList != null)
         {
             HostRunConfigObject configObj;
             foreach (var p in MiddlewareTask.TaskConfigList)
             {
                 configObj = new HostRunConfigObject();
                 configObj.Label = p.taskname;
                 configObj.Key = p.taskname;
                 configObj.Value = p.taskname;
                 configObj.Memo = (p.qswitch ? "已开启" : "未开启") + "\t" + p.execfrequencyName + "\t" + p.shorttimeName + "\t" + p.serialorparallelName;
                 subject.ConfigObjList.Add(configObj);
             }
         }
     });
     HostRunConfigInfo.LoadConfigInfo(Identify, psAction, pubsAction, subsAction, taskAction);
     #endregion
 }
Exemple #4
0
 public List <PublishServiceObject> GetPublishServiceList()
 {
     return(PublisherManage.GetPublishServiceList());
 }
Exemple #5
0
        public static void Run(StartType type)
        {
            switch (type)
            {
            case StartType.BaseService:
                mAppHost = new ServiceHost(typeof(BaseService));
                //初始化连接池,默认10分钟清理连接
                ClientLinkPoolCache.Init(true, 200, 30, 600, "wcfserver", 30);

                AppGlobal.AppRootPath = System.Windows.Forms.Application.StartupPath + "\\";
                AppGlobal.appType     = AppType.WCF;
                AppGlobal.IsSaas      = HostSettingConfig.GetValue("issaas") == "1" ? true : false;
                AppGlobal.AppStart();


                ClientManage.IsHeartbeat   = HostSettingConfig.GetValue("heartbeat") == "1" ? true : false;
                ClientManage.HeartbeatTime = Convert.ToInt32(HostSettingConfig.GetValue("heartbeattime"));

                ClientManage.StartHost();
                mAppHost.Open();

                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "数据服务启动完成");
                break;

            case StartType.FileService:
                AppGlobal.AppRootPath = System.Windows.Forms.Application.StartupPath + "\\";

                mFileHost = new ServiceHost(typeof(FileService));
                mFileHost.Open();

                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "文件服务启动完成");
                break;

            case StartType.HttpService:
                //初始化连接池,默认10分钟清理连接
                ClientLinkPoolCache.Init(true, 200, 30, 600, "httpserver", 30);
                AppGlobal.AppRootPath = System.Windows.Forms.Application.StartupPath + "\\";

                mHttpHost = new WebServiceHost(typeof(HttpService));
                mHttpHost.Open();

                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "Http服务启动完成");
                break;

            case StartType.RouterBaseService:
                mRouterHost = new ServiceHost(typeof(RouterBaseService));
                RouterManage.Start();
                mRouterHost.Open();

                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "路由数据服务启动完成");
                break;

            case StartType.RouterFileService:
                mFileRouterHost = new ServiceHost(typeof(RouterFileService));
                mFileRouterHost.Open();

                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "路由文件服务启动完成");
                break;

            case StartType.SuperClient:
                SuperClient.Start();
                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "超级客户端启动完成");

                PublisherManage.Start();
                SubscriberManager.Start();
                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "发布订阅启动完成");

                DistributedCacheManage.Start();
                DistributedCacheClient.Start();
                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "分布式缓存启动完成");

                UpgradeManage.Start();
                UpgradeClient.Start();
                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "升级包管理启动完成");

                MonitorTirggerManage.Start();
                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "监视触发器启动完成");
                break;

            case StartType.MiddlewareTask:
                MiddlewareTask.StartTask();    //开启定时任务
                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "定时任务启动完成");
                break;
            }
        }