We’re just starting off on a project that’s utilising EventStore, and I’ve been working on a client to consume events in C#. One bit I’m uncertain about is how best to handle internal application exceptions (not errors with the EventStore connection, but other sources). I’ve got an OnEventAppeared block similar to this:
private void StartProjection()
subscription = _conn.SubscribeToStreamFrom(
private Action<EventStoreCatchUpSubscription, ResolvedEvent> OnEventReceived()
return (sub, e) =>
// Process event
catch (Exception ex)
// Log exception
The final throw seems to stop further reads from the stream, which is what I want in this circumstance. But what I’d like to do at that point is start into an alerting/recovery/shutdown cycle so I can either restart reading from an appropriate point, or go into an orderly shutdown of the reader application. I was wondering if there were any events in the client library that could subscribe to that would be triggered in this case? Or if there were any other suggestions or best practices on how to react to exceptions in the event appeared callback?
Any other suggestions or examples on how best to code an EventStore client for exception recovery are welcome.