1. What does the server do when we send PersistentSubscriptionNakEventAction.Unknown?

  2. We are using Competing consumers and we enable keep reconnecting option when we create a connection. However, if the event store is shutdown, it throws a connection closed exception. When event store comes up, the connection is not reestablished. Is this the expected workflow or am I doing something wrong? What is the best practice to reconnect (add a retry logic inside OnSubscriptionDropped??)?


var credentials = new EventStore.ClientAPI.SystemData.UserCredentials(“admin”, “changeit”);
var settings = PersistentSubscriptionSettings
var connsettings = ConnectionSettings.Create().SetDefaultUserCredentials(credentials);
connsettings = connsettings.KeepReconnecting().KeepRetrying();
var endpoint = new System.Net.IPEndPoint(System.Net.IPAddress.Loopback.Address, 1113);
using (var conn = EventStoreConnection.Create(connsettings, endpoint))
conn.CreatePersistentSubscriptionAsync(“test-stream”, “test-group”, settings, credentials);
conn.ConnectToPersistentSubscriptionAsync(“test-stream”, “test-group”,
(subscriber, evt) =>
Console.WriteLine(“Here-Read event with data: {0}”,
catch (Exception e)
subscriber.Fail(evt, PersistentSubscriptionNakEventAction.Park, “Try again”);
(subscriber, reason, exception) => {
autoAck: false);

Hi Anand

  1. When you send a PersistentSubscriptionNakEventAction.Unknown, your event will be retried up until the MaxRetryCount and then it will be parked.

  2. KeepReconnecting() only affects the connection itself. You will need to add logic to reconnect to the Persistent Subscription yourself in the SubscriptionDropped handler.

Thanks !!

Btw under what conditions does the connection die (and it throws a connection closed exception)?

I have noticed this happen while debugging and when virtual machine locks out after inactivity (event thought machine is connected to network)…

the one you are seeing is heartbeat timeouts. when you debug in visual
studio the debugger stops all threads in the process. the default
settings are to try to detect a possibly dead endpoint about once per
second. raise the heartbeat interval and this problem should go away.