private void SetupSystem() { var client = new PulsarClientConfigBuilder(); var path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var config = GetIConfigurationRoot(path); var clienConfigSetting = config.GetSection("client"); var serviceUrl = clienConfigSetting.GetSection("service-url").Value; var webUrl = clienConfigSetting.GetSection("web-url").Value; var authPluginClassName = clienConfigSetting.GetSection("authPluginClassName").Value; var authParamsString = clienConfigSetting.GetSection("authParamsString").Value; var authCertPath = clienConfigSetting.GetSection("authCertPath").Value; var connectionsPerBroker = int.Parse(clienConfigSetting.GetSection("connections-per-broker").Value); var statsInterval = int.Parse(clienConfigSetting.GetSection("stats-interval").Value); var operationTime = int.Parse(clienConfigSetting.GetSection("operationTime").Value); var allowTlsInsecureConnection = bool.Parse(clienConfigSetting.GetSection("allowTlsInsecureConnection").Value); var enableTls = bool.Parse(clienConfigSetting.GetSection("enableTls").Value); var enableTxn = bool.Parse(clienConfigSetting.GetSection("enableTransaction").Value); var dedicatedConnection = bool.Parse(clienConfigSetting.GetSection("userDedicatedConnection").Value); client.EnableTransaction(enableTxn); if (operationTime > 0) { client.OperationTimeout(TimeSpan.FromMilliseconds(operationTime)); } if (!string.IsNullOrWhiteSpace(authCertPath)) { client.AddTrustedAuthCert(new X509Certificate2(File.ReadAllBytes(authCertPath))); } if (!string.IsNullOrWhiteSpace(authPluginClassName) && !string.IsNullOrWhiteSpace(authParamsString)) { client.Authentication(authPluginClassName, authParamsString); } client.ServiceUrl(serviceUrl); client.WebUrl(webUrl); client.ConnectionsPerBroker(connectionsPerBroker); client.StatsInterval(statsInterval); client.AllowTlsInsecureConnection(allowTlsInsecureConnection); client.EnableTls(enableTls); var system = PulsarSystem.GetInstance(client); Client = system.NewClient(); PulsarSystem = system; ClientConfigurationData = client.ClientConfigurationData; }