I’m writing a subscriber to all events using the .NET API and Event Store 3.5.0. I’m having issues getting durability built into my subscriber. I’m passing a method into the SubscriptionDropped parameter when I do my connection.SubscribeToAllFrom. All works great for happy path. Events appear and get processed as expected. To test durability and recoverability, I’m shutting down Event Store and starting it back up. When I do this, my SubscriptionDropped method gets called as expected and I perform a SubscribeToAllFrom again. However, it seems like even though the initial subscription is “dropped”, it’s still handling events that appear. I’m seeing this via Debug output where the last checkpoint record is being written multiple times on different managed threads after an event occurs. Is there something I need to be doing before resubscribing after a subscription drop?
My Debug output looks like this (commentary in bold):
(Initial subscribe on startup)
ReadModelEventSubscriber (1) subscribing to all events
(Shutting down and restarting Event Store)
ReadModelEventSubscriber (11) subscription dropped with reason ConnectionClosed. Exception: Connection was closed.
ReadModelEventSubscriber (11) subscribing to all events
ReadModelEventSubscriber (11) is now resubscribed after the subscription dropped
(Shutting down and restarting Event Store a second time)
ReadModelEventSubscriber (9) subscription dropped with reason ConnectionClosed. Exception: Connection was closed.
ReadModelEventSubscriber (9) subscribing to all events
ReadModelEventSubscriber (9) is now resubscribed after the subscription dropped
(I send a single event and the event is handled three times and the same checkpoint is written three times)
ReadModelEventSubscriber (10) writing checkpoint 2599714 for FieldDetailsChangedEvent
ReadModelEventSubscriber (12) writing checkpoint 2599714 for FieldDetailsChangedEvent
ReadModelEventSubscriber (13) writing checkpoint 2599714 for FieldDetailsChangedEvent