Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ private Task HandleChannelExceptionAsync(object? sender, CallbackExceptionEventA
await Locker.WaitAsync();
try
{
_monitor.Remove(this);
try
{
await teardownChannel();
Expand All @@ -137,6 +136,18 @@ private Task HandleChannelExceptionAsync(object? sender, CallbackExceptionEventA

Logger.LogInformation("Restarted the Rabbit MQ channel");
}
catch (Exception e)
{
// The broker is likely unavailable (e.g. a broker roll). Leave this agent registered
// with the ConnectionMonitor and marked Disconnected so RecoverySucceededAsync rebuilds
// it once the connection returns. Previously the agent was removed from the monitor
// before the restart attempt, so a failure here orphaned it permanently: the connection
// recovery loop iterates the monitor's tracked agents, so a removed listener is never
// rebuilt and its queue is left with zero consumers on an otherwise-healthy process.
State = AgentState.Disconnected;
Logger.LogWarning(e,
"Could not eagerly restart the Rabbit MQ channel; leaving it for connection recovery");
}
finally
{
Locker.Release();
Expand Down
Loading