EventStore / EventStore-Client-Dotnet

Dotnet Client SDK for the Event Store gRPC Client API written in C#
Other
140 stars 38 forks source link

Expose ES Ping Functionality through EventStoreClient #241

Closed NielsPilgaard closed 1 year ago

NielsPilgaard commented 1 year ago

Is your feature request related to a problem? Please describe. I have a hard time validating that my ES connection is healthy without performing an operation that would create a stream. The only reliable method I've found is to briefly subscribe to the All stream: https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/blob/master/src/HealthChecks.EventStore.gRPC/EventStoreHealthCheck.cs#L25

Describe the solution you'd like I would like the ability to ping EventStore through the EventStoreClient, to validate a healthy connection based on the response, or lack of response.

Describe alternatives you've considered I've considered the following:

Additional context If implemented, I plan to use the Ping functionality in the ES gRPC HealthCheck nuget: https://www.nuget.org/packages/AspNetCore.HealthChecks.EventStore.gRPC

alexeyzimarev commented 1 year ago

You don't necessarily need to subscribe to $all, you can read, for example, the last event from $all

NielsPilgaard commented 1 year ago

Ah right - Is there always at least 1 event in $all?

alexeyzimarev commented 1 year ago

There should be something there as when the server starts it writes something to it. In any case, $all exists unconditionally, so even if you get an empty response (which I doubt), you understand that the call went through. You will never get Stream not found when reading from $all for sure :)

NielsPilgaard commented 1 year ago

That should work nicely then, thank you!