protected override void CoreInnerOnLoading() { //注册processors //MidiatorGlobal.Initialize(); //配置数据库连接字符串 Global.DbMySql = new Database(SystemWorker.Instance.ConfigurationProxy.GetField("CoinAPI", Global.MySql), Global.CommandTimeOut); DatabaseManager.Inject(Global.DbMySql, Global.DbMySql); ServiceManager.Instance.Initialize(); Global.RemoteApiService = ServiceManager.Instance.GetService <RemoteApiService>(); Global.RemoteApiService.Initialize(); _protocolStack = new MetadataProtocolStack(); _tracing.Info(" #CoinAPI::Initialize protocol stack succeed!"); Console.WriteLine(" #CoinAPI::Initialize protocol stack succeed!"); _transactionManager = new MetadataTransactionManager(new TransactionIdentityComparer()); _scheduler = new MetadataMessageRequestScheduler(); //注册代理器 _scheduler.Regist(new GetTickerFromOKCoinProcessor()); _scheduler.CreateDynamicCounters(); _tracing.Info(" #CoinAPI::Regist business processors succeed!"); Console.WriteLine(" #CoinAPI::Regist business processors succeed!"); _tracing.Info(" #CoinAPI::BasicBusinessComponent load succeed!"); Console.WriteLine(" #CoinAPI::BasicBusinessComponent load succeed!"); }
protected override void CoreInnerStop() { if (_hostChannel == null) { return; } _hostChannel.ChannelCreated -= ChannelCreated; _hostChannel = null; _scheduler.DistoryDynamicCounters(); _scheduler = null; _tracing.Info(" #Stop CoinAPI::BasicBusinessComponent succeed!"); }