コード例 #1
0
 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)
 {
 }
コード例 #2
0
        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);
        }