EasyNetQ
EasyNetQ copied to clipboard
Replacement for IsConnected/ConnectAsync, these methods are misleading
Fixes #1513, Related to #1650, #1433, #1462, #1301, #1147.
There were a lot of complaints for IsConnected
behaviour after we added multiple connections under the hood for producer and consumer respectively in #1273. Moreover, laziness of connections made the situation even worse.
I believe that we should remain connections lazy, so providing API to inspect connection status precisely per connection type (instead of global IsConnected
property) might reduce awkwardness of the API.
The PR introduces several new methods to IAdvancedBus
:
-
PersistentConnectionStatus GetConnectionStatus(PersistentConnectionType type)
-
Task EnsureConnectedAsync(PersistentConnectionType type, CancellationToken cancellationToken = default);
EnsureConnectedAsync
fixes a small ambiguity of ConnectAsync
: ConnectAsync
doesn't not throw when a connection was established, but then disrupted.