コード例 #1
0
 /// <summary>
 ///     初始化属于指定服务角色的系统工作者
 /// </summary>
 /// <param name="role">服务角色</param>
 /// <param name="setting">远程配置设置</param>
 /// <param name="configurationProxy">远程配置站访问代理器</param>
 /// <param name="notificationHandler">异常通知处理器</param>
 /// <param name="proxy">KAE资源代理器</param>
 /// <exception cref="ArgumentNullException">参数不能为空</exception>
 public static void Initialize(string role, RemoteConfigurationSetting setting, IRemoteConfigurationProxy configurationProxy, ITracingNotificationHandler notificationHandler = null, IKAEResourceProxy proxy = null)
 {
     if (IsInitialized)
     {
         return;
     }
     if (setting == null)
     {
         setting = RemoteConfigurationSetting.Default;
     }
     if (proxy == null)
     {
         proxy = new KAEHostResourceProxy();
     }
     if (string.IsNullOrEmpty(role))
     {
         throw new ArgumentNullException(nameof(role));
     }
     if (configurationProxy == null)
     {
         throw new ArgumentNullException(nameof(configurationProxy));
     }
     SystemConfigurations.Initialize(role, setting, configurationProxy);
     _tracing = TracingManager.GetTracing(typeof(SystemWorker));;
     TransactionGlobal.Initialize();
     _configurationProxy = configurationProxy;
     _hostProxy          = proxy;
     TracingManager.NotificationHandler = notificationHandler ?? new RemoteLogProxy();
     InitializeCore(role);
     //initialize long...long memory buffer for tcp layer.
     ChannelConst.Initialize();
     _isInitialized   = true;
     IsInSpecifiedKPP = false;
 }
コード例 #2
0
 /// <summary>
 ///    网络消息事务代理器抽象父类
 /// </summary>
 /// <param name="container">网络协议栈容器</param>
 /// <param name="cluster">网络负载器</param>
 /// <param name="transactionManager">事务管理器</param>
 /// <param name="hostProxy">KAE宿主透明代理</param>
 /// <param name="appUniqueId">应用唯一编号</param>
 /// <exception cref="ArgumentException">参数不能为空</exception>
 protected MessageTransactionProxy(IProtocolStackContainer container, INetworkCluster <TMessage> cluster, ITransactionManager <TMessage> transactionManager, IKAEResourceProxy hostProxy, Guid appUniqueId)
 {
     if (container == null)
     {
         throw new ArgumentNullException("container");
     }
     if (cluster == null)
     {
         throw new ArgumentNullException("cluster");
     }
     if (transactionManager == null)
     {
         throw new ArgumentNullException("transactionManager");
     }
     if (hostProxy == null)
     {
         throw new ArgumentNullException("hostProxy");
     }
     _container          = container;
     _cluster            = cluster;
     _transactionManager = transactionManager;
     _hostProxy          = hostProxy;
     _appUniqueId        = appUniqueId;
 }
コード例 #3
0
 /// <summary>
 ///     为KPP专门设计的初始化SystemWorker的函数
 /// </summary>
 /// <param name="role">服务角色</param>
 /// <param name="proxy">KAE资源代理器</param>
 /// <param name="settings">KJFramework网络层设置集</param>
 /// <param name="appUniqueId">APP唯一编号</param>
 /// <exception cref="ArgumentNullException">参数不能为空</exception>
 internal static void InitializeForKPP(string role, IKAEResourceProxy proxy, ChannelInternalConfigSettings settings, Guid appUniqueId)
 {
     if (IsInitialized)
     {
         return;
     }
     if (string.IsNullOrEmpty(role))
     {
         throw new ArgumentNullException(nameof(role));
     }
     _hostProxy          = proxy;
     _appUniqueId        = appUniqueId;
     _configurationProxy = new KPPConfigurationProxy(proxy);
     SystemConfigurations.Initialize(role, RemoteConfigurationSetting.Default, _configurationProxy);
     _tracing = TracingManager.GetTracing(typeof(SystemWorker));;
     TransactionGlobal.Initialize();
     //Regist("LGS", new LGSProtocolStack());
     TracingManager.NotificationHandler = new RemoteLogProxy();
     InitializeCore(role);
     //initialize long...long memory buffer for tcp layer.
     ChannelConst.Initialize(settings);
     _isInitialized   = true;
     IsInSpecifiedKPP = true;
 }
コード例 #4
0
 /// <summary>
 ///    转为KPP准备的内部配置获取代理器
 /// </summary>
 /// <param name="proxy">KAE宿主代理器</param>
 public KPPConfigurationProxy(IKAEResourceProxy proxy)
 {
     _proxy = proxy;
 }
コード例 #5
0
 /// <summary>
 ///    应用初始化
 /// </summary>
 /// <param name="structure">KPP资源包的数据结构</param>
 /// <param name="settings">APP所使用的网络资源设置集</param>
 /// <param name="proxy">KAE宿主代理器</param>
 /// <param name="greyPolicyCode">灰度升级策略脚本</param>
 internal void Initialize(KPPDataStructure structure, ChannelInternalConfigSettings settings, IKAEResourceProxy proxy, string greyPolicyCode = null)
 {
     _structure             = structure;
     Version                = _structure.GetSectionField <string>(0x00, "Version");
     PackageName            = _structure.GetSectionField <string>(0x00, "PackName");
     Description            = _structure.GetSectionField <string>(0x00, "PackDescription");
     GlobalUniqueId         = _structure.GetSectionField <Guid>(0x00, "GlobalUniqueIdentity");
     Level                  = (ApplicationLevel)_structure.GetSectionField <byte>(0x00, "ApplicationLevel");
     IsCompletedEnvironment = _structure.GetSectionField <bool>(0x00, "IsCompletedEnvironment");
     Status                 = ApplicationStatus.Initializing;
     try
     {
         _processors = CollectAbilityProcessors();
         InnerInitialize();
         Status = ApplicationStatus.Initialized;
     }
     catch (Exception ex)
     {
         _tracing.Error(ex);
         Status = ApplicationStatus.Exception;
         throw;
     }
 }
コード例 #6
0
 /// <summary>
 ///    网络消息事务代理器抽象父类
 /// </summary>
 /// <param name="container">网络协议栈容器</param>
 /// <param name="cluster">网络负载器</param>
 /// <param name="transactionManager">事务管理器</param>
 /// <param name="hostProxy">KAE宿主透明代理</param>
 /// <param name="appUniqueId">应用唯一编号</param>
 public BusinessMessageTransactionProxy(IProtocolStackContainer container, INetworkCluster <BaseMessage> cluster, ITransactionManager <BaseMessage> transactionManager, IKAEResourceProxy hostProxy, Guid appUniqueId)
     : base(container, cluster, transactionManager, hostProxy, appUniqueId)
 {
 }