0

Currently deployed services to the Azure container apps and they communicate through the azure service bus

During communication, a service will send 4000 messages some messages will throw errors because of the database max connections (200) to the database, therefore the messages have to be retried, But the problem is that the is no backoff time before a message is retried therefore most of those messages end up in the Dead letter queue after reaching the maxDeliveryCount.

Is there a metadata field on the Dapr component spec like backOffInitialInterval to set the time to wait before resending the message?

below is my bicep file

resource daprComponent 'daprComponents@2022-03-01' = {
    name: 'ifms-dapr-pubsub'
    properties: {
      componentType: 'pubsub.azure.servicebus'
      version: 'v1'
      secrets: [
        {
          name: 'service-bus-connection-string'
          value: 'Endpoint=sb://${serviceBusName}.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=${listKeys('${serviceBusId}/AuthorizationRules/RootManageSharedAccessKey', serviceBusApiVersion).primaryKey}'
        }
      ]
      metadata: [
        {
          name: 'connectionString'
          secretRef: 'service-bus-connection-string'
        }
        {
          name: 'maxDeliveryCount'
          value: '1000'
        }
      ]
    }
  }

from the link there is a Mode and Delay in the ServiceBusRetryOptions for the client library

Makhele Sabata
  • 582
  • 6
  • 16

1 Answers1

1

To set the initial backoff interval for the retry policy, you can add a metadata field to your daprComponent resource with the name retryOptions and a value that includes a mode and delay property.

For example, you can set the back off retry policy to exponentially expand the delay starting with a value of 5 seconds as follows:

metadata: [
    {
        name: 'connectionString',
        secretRef: 'service-bus-connection-string',
    },
    {
        name: 'maxDeliveryCount',
        value: '1000',
    },
    {
        name: 'retryOptions',
        value: json({
            mode: 'exponential',
            delay: '00:00:05',
        }),
    },
],
tmarwen
  • 15,750
  • 5
  • 43
  • 62