I am having a following code snippet in my application to send a message to the Azure service bus topic queue. Randomly I am getting the generic ServiceBusException during sending messages.
var serialized = JsonConvert.SerializeObject(message);
var _client = new TopicClient(connectionString, $"{queuePrefix}{queueName}");
var m = new Message(Encoding.ASCII.GetBytes(serialized))
{
MessageId = messageId,
ContentType = "application/json"
};
await RetryHelper.WithRetries(async () =>
{
await _client.SendAsync(m);
}, new Common.RetryPolicy(3, TimeSpan.Zero, typeof(ServiceBusTimeoutException)));
Here is my exception mesage,
The service was unable to process the request; please retry the operation. For more information on exception types and proper exception handling, please refer to http://go.microsoft.com/fwlink/?LinkId=761101 TrackingId:24e3ca8e-a74f-4f1b-a0e6-acf4e98a0bdc_G9, SystemTracker:client-link78653, Timestamp:2019-01-06T01:35:50
Microsoft.Azure.ServiceBus.ServiceBusException
As the exception is not specific as listed in this page - https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-messaging-exceptions, I am finding hard to understand the root cause of the exception and take corrective measures.
I would appreciate any information to investigate further.
ServiceBusException
is a base exception of all other exceptions. Errors taking place on the broker side are sent back and translated. In this case, it's not something that is convertible to the most common errors described in the documentation. In situation such as this one, retrying is the right thing to do as the exception was intermittent. Saying that, there are few things to consider.
RetryPolicy
that is retrying send operation. Your retries should be applied after some back-off time if that's possible.ServerBusyException
.TrackingId
code that was provided with the exception can be used to open a support case to start an investigation and understand better what happened.Would suggest to contact support and provide with Tracking IDs you've had to help you understand why do you see this error so often.