Setting up a Clustered connection to KeepRetrying

Hi,

I’m trying to setup a Clustered connection using the ConnectionSettings to keep trying to connect to EventStore when the service has gone down.

When I connect to a single instance, the settings are respected the connection keeps retrying for the specified period.

If I then use this same settings object with the clustered connection, it doesn’t respect the settings.

My example code is:

var settings = ConnectionSettings.Create()

.KeepReconnecting()

.SetReconnectionDelayTo(TimeSpan.FromSeconds(10))

.UseConsoleLogger();

//

// Attempt to connect to single (unreachable) IP

//

var singleInstanceConnection = EventStoreConnection.Create(settings, CreateIPEndPoint(1));

singleInstanceConnection.ConnectAsync().Wait();

//

// Attempt to connect to (unreachable) cluster of IPs

//

var clusterSettings = ClusterSettings.Create()

.DiscoverClusterViaGossipSeeds()

.SetGossipSeedEndPoints(GetGossipSeeds())

.Build();

// Connection to cluster appears to ignore settings. Reconnects 10 times then stops.

var clusteredInstanceConnection = EventStoreConnection.Create(settings, clusterSettings);

clusteredInstanceConnection.ConnectAsync().Wait();

Am I missing something here?

Thanks in advance…

Is it errors get on discovery attempts as a guess? Not on connection retries?

I believe here is a separate setting for them.

Hi Greg, Thanks for you speedy reply.

There is a method that hangs off the ClusterSettings object called SetMaxDiscoverAttempts which results in the connection attempt being extended from the default of 10 to the specified value and that all works fine…

The problem is, I can’t change the Timeout between retries… it looked like Something the ConnectionSettings should take care of?!

I would like to SetMaxDiscoverAttempts to infinity, with a retry of every miniute (for example)

I should add, that I am on version 3.01

Thanks

John

I need to look I think it backs off automatically either way adding support for a timeout here is relatively trivial if not already there.