How can I check if ConnectAsync() even worked?

All of a sudden, my application started throwing, claiming that the event store connection was disposed and sometimes it says it was just not open. It changes at random, it seems. I’m trying to figure out how and or why that would happen but I don’t know how to check if the connection is actually open; I don’t see a connection state property. How can I check this?

The Event Store logs are a good source for finding out why the connection has been closed. Would you mind providing those so that we can help diagnose the issue?
What version of Event Store?

I was able to determine that there was a problem on the server. Our IT manager decided to start playing with firewall settings and ended up blocking the TCP port. That being said, it seems a bit unintuitive to not throw following a failed call to ConnectAsync() or at least provide a state property that I can use for health checks. v3.9.4. From the application’s standpoint, everything looked to be fine until it actually tried to interact with the connection object.

You control the behaviour with your configuration settings (you tell
the connection to keep trying to reconnect or how many times, you tell
it how many times to retry an operation). There are callbacks for
things like connection lost
https://github.com/EventStore/EventStore/blob/release-v4.0.1/src/EventStore.ClientAPI/IEventStoreConnection.cs#L591
reconnecting https://github.com/EventStore/EventStore/blob/release-v4.0.1/src/EventStore.ClientAPI/IEventStoreConnection.cs#L603
etc. Look at the ConnectionSettings object that you pass into the
connection it has many options that control reconnecting behaviour.

Greg

Are those available in 3.x?

since 1.0 :slight_smile:

roger that. I will try it out, thanks