private static void Initialize(ClientConfigManager configManager) { if (_instance.Initialized) { return; } Logger.Info($"Initializing Cat .Net Client ...Cat.Version : {PureCatClient.Version}"); DefaultMessageManager manager = new DefaultMessageManager(); manager.InitializeClient(configManager.ClientConfig); _instance.MessageManager = manager; _instance.MessageProducer = new DefaultMessageProducer(manager); _instance.Initialized = true; Logger.Info("Cat .Net Client initialized."); }
public static void Initialize(JasmineSetting config) { if (Instance.m_initialized) { LoggerManager.Warn("Cat can't initialize again , IGNORED!"); return; } LoggerManager.Info("Initializing Cat .Net Client ..."); Instance.m_Setting = config; DefaultMessageManager manager = new DefaultMessageManager(); manager.InitializeClient(config); Instance.m_Producer = new DefaultMessageProducer(manager); Instance.m_Manager = manager; Instance.m_initialized = true; LoggerManager.Info("Cat .Net Client initialized."); }
public static void Initialize(string configFile) { if (Instance._mInitialized) { Logger.Warn("Cat can't initialize again with config file({0}), IGNORED!", configFile); return; } Logger.Info("Initializing Cat .Net Client ..."); DefaultMessageManager manager = new DefaultMessageManager(); ClientConfig clientConfig = LoadClientConfig(configFile); manager.InitializeClient(clientConfig); Instance._mProducer = new DefaultMessageProducer(manager); Instance._mManager = manager; Instance._mInitialized = true; Logger.Info("Cat .Net Client initialized."); }
public static void Initialize(string configFilePath) { if (Instance.m_initialized) { LoggerManager.Warn("Cat can't initialize again with config file(%s), IGNORED!", configFilePath); return; } LoggerManager.Info("Initializing Cat .Net Client ..."); DefaultMessageManager manager = new DefaultMessageManager(); JasmineSetting clientConfig = XmlHelper.XmlDeserializeFromFile <JasmineSetting>(configFilePath, Encoding.UTF8); Instance.m_Setting = clientConfig; manager.InitializeClient(clientConfig); Instance.m_Producer = new DefaultMessageProducer(manager); Instance.m_Manager = manager; Instance.m_initialized = true; LoggerManager.Info("Cat .Net Client initialized."); }
/// <summary> /// Cat初始化 /// 1 加载客户端配置 /// 2 拿到客户端的server列表 /// 3 初始化客户端的server对象,返回ClientConfig对象 /// 4 从将客户端的server地址进行http的发送,并返回服务端的路由列表,并覆盖ClientConfig的server属性 /// 5 最后就是随机取一个可用的服务器 /// </summary> public static void Initialize() { if (_instance == null) { throw new Exception("_instance属性为null"); } if (_instance.Initialized) { return; } var configManager = new ClientConfigManager(); DefaultMessageManager manager; manager = new DefaultMessageManager(); manager.InitializeClient(configManager.ClientConfig); _instance.MessageManager = manager; _instance.MessageProducer = new DefaultMessageProducer(manager); _instance.Initialized = true; Logger.Info("Cat .Net Client initialized."); }