Azure Servicebus: Transient Fault Handling

243 views Asked by At

I have a queue receiver, which reads messages from the queue and process the message (do some processing and inserts some data to the azure table or retrieves the data).

What I observed was that any exception that my processing method (SendResponseAsync()) throws results in retry i.e. redelivery of the message to the default 10 times.

Can this behavior be customized i.e. I only retry for certain exception and ignore for other. Like if there is some network issue, then it makes sense to retry but if it is BadArgumentException(poisson message), then I may not want to retry.

Since retry is taken care by ServiceBus client library, can we customize this behavior ?

This is the code at the receiver end

public MessagingServer(QueueConfiguration config)
{
      this.requestQueueClient = QueueClient.CreateFromConnectionString(config.ConnectionString, config.QueueName);
      this.requestQueueClient.OnMessageAsync(this.DispatchReplyAsync);
}

private async Task DispatchReplyAsync(BrokeredMessage message)
{
     await this.SendResponseAsync(message);
}
0

There are 0 answers