/// <summary> /// Loads OPS config settings from its repository, performs init on in-process Order Processor Service. /// </summary> public static void initConfigOrderProcessService(object lockobject, bool force) { lock (lockobject) { if (!force && initialized) return; initialized = true; ConnectionStringSettings connSettingOPS = System.Configuration.ConfigurationManager.ConnectionStrings["OPS_CONFIGDB_SQL_CONN_STRING"]; Trade.OrderProcessorServiceConfigurationSettings.Settings.CONFIGDB_SQL_CONN_STRING = connSettingOPS.ConnectionString; Trade.OrderProcessorServiceConfigurationSettings.Settings OPSSettings = new Trade.OrderProcessorServiceConfigurationSettings.Settings(); ServiceConfigHelper configHelper = new ServiceConfigHelper(OPSSettings); Trade.OrderProcessorHostConfigurationImplementation.ConfigurationActions OPSConfigActions = new Trade.OrderProcessorHostConfigurationImplementation.ConfigurationActions(); Trade.OrderProcessorServiceConfigurationSettings.Settings.thisService = new Trade.OrderProcessorHostConfigurationImplementation.ConfigurationService(); Trade.OrderProcessorServiceConfigurationSettings.Settings.thisServiceConfigActions = OPSConfigActions; configHelper.InitializeConfigFromDatabase(false, ref Trade.OrderProcessorServiceConfigurationSettings.Settings.connectionPointList, ref Trade.OrderProcessorServiceConfigurationSettings.Settings.connectedServices, ref Trade.OrderProcessorServiceConfigurationSettings.Settings.connectedConfigServices, ref Trade.OrderProcessorServiceConfigurationSettings.Settings.hostedServices, ref Trade.OrderProcessorServiceConfigurationSettings.Settings.serviceHosts, Trade.OrderProcessorServiceConfigurationSettings.Settings.CONFIGDB_SQL_CONN_STRING); OPSConfigActions.initOrderForwardMode(); List<ConnectedServices> connectedServices = (List<ConnectedServices>)ConfigUtility.reflectGetField(OPSSettings, "connectedServices"); object OPSSettingsObject = (object)OPSSettings; if (ServiceConfigHelper.MasterServiceWebHost.MasterHost != null) { ServiceConfigHelper.initOnlineMethodsCS(connectedServices, ServiceConfigHelper.MasterServiceWebHost.MasterHost._connectedServiceContracts, ref OPSSettingsObject); } else if (ServiceConfigHelper.MasterServiceSelfHost.MasterHost != null) { ServiceConfigHelper.initOnlineMethodsCS(connectedServices, ServiceConfigHelper.MasterServiceSelfHost.MasterHost._connectedServiceContracts, ref OPSSettingsObject); } OPSConfigActions.InitCommunicationChannels(OPSSettings, null, ConfigUtility.INIT_ALL_CONNECTED_INSTANCES); } }
/// <summary> /// Loads BSL config settings from its repository, performs init on in-process Business Services. /// </summary> public static void initConfigBusinessService(object lockobject, bool force) { lock (lockobject) { if (!force && initialized) return; initialized = true; ConnectionStringSettings connSettingOPS = System.Configuration.ConfigurationManager.ConnectionStrings["OPS_CONFIGDB_SQL_CONN_STRING"]; ConnectionStringSettings connSettingBSL = System.Configuration.ConfigurationManager.ConnectionStrings["BSL_CONFIGDB_SQL_CONN_STRING"]; StockTraderWebApplicationSettings.Settings.BSL_CONFIGDB_SQL_CONN_STRING = connSettingBSL.ConnectionString; StockTraderWebApplicationSettings.Settings.OPS_CONFIGDB_SQL_CONN_STRING = connSettingOPS.ConnectionString; Trade.BusinessServiceConfigurationSettings.Settings.CONFIGDB_SQL_CONN_STRING = StockTraderWebApplicationSettings.Settings.BSL_CONFIGDB_SQL_CONN_STRING; Trade.BusinessServiceConfigurationSettings.Settings BSLSettings = new Trade.BusinessServiceConfigurationSettings.Settings(); ServiceConfigHelper configHelper = new ServiceConfigHelper(BSLSettings); Trade.BusinessServiceHostConfigurationImplementation.ConfigurationActions BSLConfigActions = new Trade.BusinessServiceHostConfigurationImplementation.ConfigurationActions(); Trade.BusinessServiceConfigurationSettings.Settings.thisService = new Trade.BusinessServiceHostConfigurationImplementation.ConfigurationService(); Trade.BusinessServiceConfigurationSettings.Settings.thisServiceConfigActions = BSLConfigActions; configHelper.InitializeConfigFromDatabase(false, ref Trade.BusinessServiceConfigurationSettings.Settings.connectionPointList, ref Trade.BusinessServiceConfigurationSettings.Settings.connectedServices, ref Trade.BusinessServiceConfigurationSettings.Settings.connectedConfigServices, ref Trade.BusinessServiceConfigurationSettings.Settings.hostedServices, ref Trade.BusinessServiceConfigurationSettings.Settings.serviceHosts, Trade.BusinessServiceConfigurationSettings.Settings.CONFIGDB_SQL_CONN_STRING); BSLConfigActions.initBusinessService(BSLSettings); if (Trade.BusinessServiceConfigurationSettings.Settings.ORDER_PROCESSING_MODE == StockTraderUtility.OPS_INPROCESS) { Trade.OrderProcessorServiceConfigurationSettings.Settings.CONFIGDB_SQL_CONN_STRING = StockTraderWebApplicationSettings.Settings.OPS_CONFIGDB_SQL_CONN_STRING; string thelockobject = "0"; Trade.BusinessServiceHostConfigurationImplementation.InitConfigInProcessOrderService.initConfigOrderProcessService(thelockobject,false); } RemoteNotifications remoteNotify = new RemoteNotifications(new Trade.BusinessServiceConfigurationSettings.Settings()); remoteNotify.notifyRemoteClientsAndHosts(false, ConfigUtility.ADD_HOSTS); List<ConnectedServices> connectedServices = (List<ConnectedServices>)ConfigUtility.reflectGetField(BSLSettings, "connectedServices"); object BSLSettingsObject = (object)BSLSettings; if (ServiceConfigHelper.MasterServiceWebHost.MasterHost != null) { ServiceConfigHelper.initOnlineMethodsCS(connectedServices, ServiceConfigHelper.MasterServiceWebHost.MasterHost._connectedServiceContracts, ref BSLSettingsObject); } else if (ServiceConfigHelper.MasterServiceSelfHost.MasterHost != null) { ServiceConfigHelper.initOnlineMethodsCS(connectedServices, ServiceConfigHelper.MasterServiceSelfHost.MasterHost._connectedServiceContracts, ref BSLSettingsObject); } BSLConfigActions.InitCommunicationChannels(BSLSettings, null, ConfigUtility.INIT_ALL_CONNECTED_INSTANCES); } }