Пример #1
0
        public IEventStoreConnection CreateConnectionWithGossipSeeds(Func <ConnectionSettingsBuilder, ConnectionSettingsBuilder> configureSettings = default, bool useDnsEndPoint = false)
        {
            var settings = (configureSettings ?? DefaultConfigureSettings)(DefaultBuilder)
                           .UseCustomHttpClient(new HttpAsyncClient(TimeSpan.FromSeconds(5),
                                                                    new HttpClientHandler {
                ServerCertificateCustomValidationCallback = delegate { return(true); }
            }))
                           .Build();
            var gossipSeeds     = GetGossipSeedEndPointsExceptFor(-1, false).Cast <IPEndPoint>().ToArray();
            var clusterSettings = new ClusterSettingsBuilder()
                                  .DiscoverClusterViaGossipSeeds()
                                  .SetGossipSeedEndPoints(true, gossipSeeds)
                                  .SetMaxDiscoverAttempts(1)
                                  .Build();

            return(EventStoreConnection.Create(settings, clusterSettings));
        }
Пример #2
0
        public IEventStoreConnection CreateConnectionWithGossipSeeds(Func <ConnectionSettingsBuilder, ConnectionSettingsBuilder> configureSettings = default, bool useDnsEndPoint = false)
        {
            var settings = (configureSettings ?? DefaultConfigureSettings)(DefaultBuilder)
                           .UseCustomHttpMessageHandler(new SocketsHttpHandler {
                SslOptions =
                {
                    RemoteCertificateValidationCallback = delegate { return(true); }
                }
            })
                           .Build();
            var gossipSeeds     = GetGossipSeedEndPointsExceptFor(-1, useDnsEndPoint);
            var clusterSettings = new ClusterSettingsBuilder()
                                  .DiscoverClusterViaGossipSeeds()
                                  .SetGossipSeedEndPoints(true, gossipSeeds)
                                  .SetMaxDiscoverAttempts(1)
                                  .Build();

            return(EventStoreConnection.Create(settings, clusterSettings));
        }