Skip to content

Commit 07edd0b

Browse files
Convert "Invalid operation while connection is closing" to retriable ServiceBusException. (Azure#17023)
* add retriable exception * add helper class to AmqpExceptionHelper.GetClientException
1 parent 9a916fe commit 07edd0b

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

sdk/servicebus/Microsoft.Azure.ServiceBus/src/Amqp/AmqpExceptionHelper.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,9 @@ public static Exception GetClientException(Exception exception, string reference
215215
case TimeoutException _:
216216
return new ServiceBusTimeoutException(message, aggregateException);
217217

218+
case InvalidOperationException ex when ex.Message.IndexOf("connection is closing", StringComparison.OrdinalIgnoreCase) != -1:
219+
return new ServiceBusException(true, aggregateException);
220+
218221
case InvalidOperationException _ when connectionError:
219222
return new ServiceBusCommunicationException(message, aggregateException);
220223
}

sdk/servicebus/Microsoft.Azure.ServiceBus/src/Core/MessageReceiver.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1486,7 +1486,7 @@ async Task DisposeMessagesAsync(IEnumerable<Guid> lockTokens, Outcome outcome)
14861486

14871487
throw new MessageLockLostException(Resources.MessageLockLost);
14881488
}
1489-
1489+
14901490
throw AmqpExceptionHelper.GetClientException(exception);
14911491
}
14921492
}

0 commit comments

Comments
 (0)