Azure Service Bus

Detailed documentation on the Azure Service Bus pubsub component

Setup Azure Service Bus

Follow the instructions here on setting up Azure Service Bus Topics.

Create a Dapr component

The next step is to create a Dapr component for Azure Service Bus.

Create the following YAML file named azuresb.yaml:

  1. apiVersion: dapr.io/v1alpha1
  2. kind: Component
  3. metadata:
  4. name: <NAME>
  5. namespace: <NAMESPACE>
  6. spec:
  7. type: pubsub.azure.servicebus
  8. version: v1
  9. metadata:
  10. - name: connectionString
  11. value: <REPLACE-WITH-CONNECTION-STRING> # Required.
  12. - name: timeoutInSec
  13. value: <REPLACE-WITH-TIMEOUT-IN-SEC> # Optional. Default: "60". Timeout for sending messages and management operations.
  14. - name: handlerTimeoutInSec
  15. value: <REPLACE-WITH-HANDLER-TIMEOUT-IN-SEC> # Optional. Default: "60". Timeout for invoking app handler.
  16. - name: disableEntityManagement
  17. value: <REPLACE-WITH-DISABLE-ENTITY-MANAGEMENT> # Optional. Default: false. When set to true, topics and subscriptions do not get created automatically.
  18. - name: maxDeliveryCount
  19. value: <REPLACE-WITH-MAX-DELIVERY-COUNT> # Optional. Defines the number of attempts the server will make to deliver a message.
  20. - name: lockDurationInSec
  21. value: <REPLACE-WITH-LOCK-DURATION-IN-SEC> # Optional. Defines the length in seconds that a message will be locked for before expiring.
  22. - name: lockRenewalInSec
  23. value: <REPLACE-WITH-LOCK-RENEWAL-IN-SEC> # Optional. Default: "20". Defines the frequency at which buffered message locks will be renewed.
  24. - name: maxActiveMessages
  25. value: <REPLACE-WITH-MAX-ACTIVE-MESSAGES> # Optional. Default: "10000". Defines the maximum number of messages to be buffered or processing at once.
  26. - name: maxActiveMessagesRecoveryInSec
  27. value: <REPLACE-WITH-MAX-ACTIVE-MESSAGES-RECOVERY-IN-SEC> # Optional. Default: "2". Defines the number of seconds to wait once the maximum active message limit is reached.
  28. - name: maxConcurrentHandlers
  29. value: <REPLACE-WITH-MAX-CONCURRENT-HANDLERS> # Optional. Defines the maximum number of concurrent message handlers
  30. - name: prefetchCount
  31. value: <REPLACE-WITH-PREFETCH-COUNT> # Optional. Defines the number of prefetched messages (use for high throughput / low latency scenarios)
  32. - name: defaultMessageTimeToLiveInSec
  33. value: <REPLACE-WITH-MESSAGE-TIME-TO-LIVE-IN-SEC> # Optional.
  34. - name: autoDeleteOnIdleInSec
  35. value: <REPLACE-WITH-AUTO-DELETE-ON-IDLE-IN-SEC> # Optional.

NOTE: The above settings are shared across all topics that use this component.

Warning

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

Apply the configuration

Visit this guide for instructions on configuring pub/sub components.

Related links

Last modified February 16, 2021: Merge pull request #1235 from dapr/update-v0.11 (b4e9fbb)