This will do the trick. The client library is 3.9.4 and server is 3.9.3.
void CreateSubscription(IEventStoreConnection c)
{
Thread.Sleep(100);
“Creating subscription”.Dump();
c.SubscribeToStreamFrom(“footest”, 0, true, (sub, evt) => evt.Dump(), subscriptionDropped: (sub, reason, e) =>
{
$“Subscription faulted: {e}”.Dump();
CreateSubscription©;
});
}
var connectionString = “GossipSeeds=127.0.0.1:1113,127.0.0.1:2113,127.0.0.1:3113; HeartBeatTimeout=500;MaxReconnections=10000000;MaxRetries=10000000”;
var connection = EventStoreConnection.Create(connectionString);
connection.ConnectAsync().Wait(TimeSpan.FromSeconds(5));
CreateSubscription(connection);
Util.KeepRunning();
``
It’s a linqpad script, so replace Dump() with Console.WriteLine…
Event store is running when I start the script and a few events are in “footest”.
When I stop the event store after a while I get:
Subscription faulted: System.ObjectDisposedException: Cannot access a disposed object.
Object name: ‘ES-add1527b-6840-4311-a5e1-e129789a3c19’.
``