Dropped subscription

Hi,

Just upgraded to 1.1 of the .NET Client API and noticed that Connected/Disconnected events have gone from the interface. If the connection is lost to the ES and any open subscription is dropped, are these subscriptions automatically recreated once the EventStoreConnection re-connects or do they need recreating? If the latter when do we know when it is valid to do that now that the Connected event has gone?

Cheers

Hi,

Connected/Disconnected/Reconnecting events were moved to ConnectionSettings, see OnConnected/OnDisconnected methods on ConnectionSettingsBuilder.

As for subscriptions – yes, they are dropped and need to be recreated by you if the subscription was established. If EventStoreConnection was disconnected before subscription confirmation came, subscription will be retried automatically.

So, if you have got subscription’s SubscriptionDropped event occurred, then you have to recreate subscription manually.

But you don’t actually have to wait for Connected event to appear. You can start creating subscriptions and sending read/write requests as soon as you called connection.Connect(…) method. This will make connection active, even though underlying TCP connection will be still pending to connect. The internal EventStoreConnection logic is smart enough to figure all this out. Requests will be delayed until TCP connection is established, if there was a drop in TCP connection, it will automatically try to reconnect (if allowed in ConnectionSettings) and retry all operations that wasn’t completed by the time TCP connection drop happened.

Ok great, thanks for the quick reply

“As for subscriptions – yes, they are dropped and need to be recreated by you if the subscription was established. If EventStoreConnection was disconnected before subscription confirmation came, subscription will be retried automatically.
So, if you have got subscription’s SubscriptionDropped event occurred, then you have to recreate subscription manually”

Is this still the case in version 2.0.2.0 of the client API?

Thanks.