public BusConnection(BusConnectionString connectionString, IBusSerializer serializer, IServiceScopeFactory serviceScopeFactory, IOptions <BusConnectionOptions> options, IBusLogger logger = null, IRetryBehavior retryBehavior = null) : this(GetConnectionFactory(connectionString), serializer, serviceScopeFactory, options, logger, retryBehavior) { }
private static IConnectionFactory GetConnectionFactory(BusConnectionString connectionString) { var factory = new ConnectionFactory { Uri = connectionString.Value, AutomaticRecoveryEnabled = true, TopologyRecoveryEnabled = true, RequestedHeartbeat = 30, NetworkRecoveryInterval = TimeSpan.FromSeconds(10), DispatchConsumersAsync = true }; if (!connectionString.ValidateCertificate) { //NOSONAR factory.Ssl.CertificateValidationCallback = (sender, certificate, chain, errors) => true; //NOSONAR factory.Ssl.AcceptablePolicyErrors = SslPolicyErrors.RemoteCertificateChainErrors | SslPolicyErrors.RemoteCertificateNotAvailable | SslPolicyErrors.RemoteCertificateNameMismatch; } return(factory); }