Hello,
I’m experimenting with a very basic EventStoreDB cluster. I have setup a cluster with 3 nodes using docker containers on the same host as described in ’ Highly-available cluster’
Every 500 ms I’m creating an event but while doing so I stop the container of the leader node. By doing so either the client hangs or the client continues but looses messages. I’m using the C# client. I will share the client code that I’m currently using so you can have a look at what I’m doing wrong.
Thanks in advance
using EventStore.Client;
using System.Text.Json;
EventStoreClient GetConnection()
{
string connectionString = new string("esdb://127.0.0.1:2113,127.0.0.1:2112,127.0.0.1:2111?tls=false&keepAliveTimeout=10000&keepAliveInterval=10000");
var settings = EventStoreClientSettings.Create(connectionString);
return new EventStoreClient(settings);
}
int i = 0;
while (i < 100)
{
var evt = new TestEvent(EntityId: Guid.NewGuid(), WhatsUp: "I wrote my first event!");
var eventData = new EventData(
Uuid.NewUuid(),
"TestEvent",
JsonSerializer.SerializeToUtf8Bytes(evt)
);
GetConnection().AppendToStreamAsync("my-first-stream", StreamState.Any, new[] { eventData });
Thread.Sleep(500);
Console.WriteLine($"Successfully written {i}");
i++;
}
public record TestEvent(Guid EntityId, String WhatsUp);