Azure Service Bus Queues binding spec

Detailed documentation on the Azure Service Bus Queues binding component

Component format

To setup Azure Service Bus Queues binding create a component of type bindings.azure.servicebusqueues. See this guide on how to create and apply a binding configuration.

Connection String Authentication

  1. apiVersion: dapr.io/v1alpha1
  2. kind: Component
  3. metadata:
  4. name: <NAME>
  5. spec:
  6. type: bindings.azure.servicebusqueues
  7. version: v1
  8. metadata:
  9. - name: connectionString # Required when not using Azure Authentication.
  10. value: "Endpoint=sb://************"
  11. - name: queueName
  12. value: queue1
  13. # - name: ttlInSeconds # Optional
  14. # value: 86400
  15. # - name: maxRetriableErrorsPerSec # Optional
  16. # value: 10
  17. # - name: minConnectionRecoveryInSec # Optional
  18. # value: 2
  19. # - name: maxConnectionRecoveryInSec # Optional
  20. # value: 300
  21. # - name: maxActiveMessages # Optional
  22. # value: 1
  23. # - name: maxConcurrentHandlers # Optional
  24. # value: 1
  25. # - name: lockRenewalInSec # Optional
  26. # value: 20
  27. # - name: timeoutInSec # Optional
  28. # value: 60

Warning

The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets as described here.

Spec metadata fields

FieldRequiredBinding supportDetailsExample
connectionStringYInput/OutputThe Service Bus connection string. Required unless using Azure AD authentication.“Endpoint=sb://**
namespaceNameNInput/OutputParameter to set the address of the Service Bus namespace, as a fully-qualified domain name. Required if using Azure AD authentication.“namespace.servicebus.windows.net”
queueNameYInput/OutputThe Service Bus queue name. Queue names are case-insensitive and will always be forced to lowercase.“queuename”
ttlInSecondsNOutputParameter to set the default message time to live. If this parameter is omitted, messages will expire after 14 days. See also86400
maxRetriableErrorsPerSecNInputMaximum number of retriable errors that are processed per second. If a message fails to be processed with a retriable error, the component adds a delay before it starts processing another message, to avoid immediately re-processing messages that have failed. Default: 1010
minConnectionRecoveryInSecNInputMinimum interval (in seconds) to wait before attempting to reconnect to Azure Service Bus in case of a connection failure. Default: 25
maxConnectionRecoveryInSecNInputMaximum interval (in seconds) to wait before attempting to reconnect to Azure Service Bus in case of a connection failure. After each attempt, the binding waits a random number of seconds, increasing every time, between the minimum and the maximum. Default: 300 (5 minutes)600
maxActiveMessagesNDefines the maximum number of messages to be processing or in the buffer at once. This should be at least as big as the maximum concurrent handlers. Default: 11
maxConcurrentHandlersNDefines the maximum number of concurrent message handlers. Default: 1.1
lockRenewalInSecNDefines the frequency at which buffered message locks will be renewed. Default: 20.20
timeoutInSecNInput/OutputTimeout for all invocations to the Azure Service Bus endpoint, in seconds. Note that this option impacts network calls and it’s unrelated to the TTL applies to messages. Default: 6060

Azure Active Directory (AAD) authentication

The Azure Service Bus Queues binding component supports authentication using all Azure Active Directory mechanisms, including Managed Identities. For further information and the relevant component metadata fields to provide depending on the choice of AAD authentication mechanism, see the docs for authenticating to Azure.

Example Configuration

  1. apiVersion: dapr.io/v1alpha1
  2. kind: Component
  3. metadata:
  4. name: <NAME>
  5. spec:
  6. type: bindings.azure.servicebusqueues
  7. version: v1
  8. metadata:
  9. - name: azureTenantId
  10. value: "***"
  11. - name: azureClientId
  12. value: "***"
  13. - name: azureClientSecret
  14. value: "***"
  15. - name: namespaceName
  16. # Required when using Azure Authentication.
  17. # Must be a fully-qualified domain name
  18. value: "servicebusnamespace.servicebus.windows.net"
  19. - name: queueName
  20. value: queue1
  21. - name: ttlInSeconds
  22. value: 60

Binding support

This component supports both input and output binding interfaces.

This component supports output binding with the following operations:

  • create

Specifying a TTL per message

Time to live can be defined on queue level (as illustrated above) or at the message level. The value defined at message level overwrites any value set at queue level.

To set time to live at message level use the metadata section in the request body during the binding invocation.

The field name is ttlInSeconds.

  1. curl -X POST http://localhost:3500/v1.0/bindings/myServiceBusQueue \
  2. -H "Content-Type: application/json" \
  3. -d '{
  4. "data": {
  5. "message": "Hi"
  6. },
  7. "metadata": {
  8. "ttlInSeconds": "60"
  9. },
  10. "operation": "create"
  11. }'

Last modified July 27, 2022: Remove namespace element from component examples (#2647) (ff9de5c8)