Skip to content

Commit 6767047

Browse files
committed
* Connection can be re-created, but publishers/consumers are not re-starting.
1 parent 8ffc92f commit 6767047

File tree

9 files changed

+345
-87
lines changed

9 files changed

+345
-87
lines changed

RabbitMQ.AMQP.Client/IConnectionSettings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public interface IConnectionSettings : IEquatable<IConnectionSettings>
1515
string ContainerId { get; }
1616
string Path { get; }
1717
bool UseSsl { get; }
18-
uint MaxFrameSize { get; }
18+
int MaxFrameSize { get; }
1919
SaslMechanism SaslMechanism { get; }
2020
ITlsSettings? TlsSettings { get; }
2121
IRecoveryConfiguration Recovery { get; }

RabbitMQ.AMQP.Client/Impl/AbstractLifeCycle.cs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,15 @@ internal async Task ReconnectAsync()
100100
int randomWait = Random.Shared.Next(300, 900);
101101
Trace.WriteLine(TraceLevel.Information, $"{ToString()} is reconnecting in {randomWait} ms, " +
102102
$"attempt: {_backOffDelayPolicy.CurrentAttempt}");
103-
await Task.Delay(randomWait).ConfigureAwait(false);
104-
await OpenAsync().ConfigureAwait(false);
103+
await Task.Delay(randomWait)
104+
.ConfigureAwait(false);
105+
106+
await OpenAsync()
107+
.ConfigureAwait(false);
108+
105109
Trace.WriteLine(TraceLevel.Information,
106110
$"{ToString()} is reconnected, attempt: {_backOffDelayPolicy.CurrentAttempt}");
111+
107112
_backOffDelayPolicy.Reset();
108113
}
109114
catch (Exception e)
@@ -112,11 +117,15 @@ internal async Task ReconnectAsync()
112117
// that's an edge case, where the link is not ready for some reason
113118
// the backoff policy will be used to delay the reconnection and give just a few attempts
114119
Trace.WriteLine(TraceLevel.Error, $"{ToString()} Failed to reconnect, {e.Message}");
120+
115121
int delay = _backOffDelayPolicy.Delay();
116-
await Task.Delay(delay).ConfigureAwait(false);
122+
await Task.Delay(delay)
123+
.ConfigureAwait(false);
124+
117125
if (_backOffDelayPolicy.IsActive())
118126
{
119-
await ReconnectAsync().ConfigureAwait(false);
127+
await ReconnectAsync()
128+
.ConfigureAwait(false);
120129
}
121130
}
122131
}

0 commit comments

Comments
 (0)