Skip to main content

Azure Service Bus Topics

Type: pubsub.azure.servicebus.topics

Status: stable

Reference: https://docs.dapr.io/reference/components-reference/supported-pubsub/setup-azure-servicebus-topics

Example

apiVersion: cra.diagrid.io/v1beta1
kind: Component
metadata:
name: <name>
spec:
type: pubsub.azure.servicebus.topics
version: v1
metadata:
# Shared access policy connection string for the Service Bus.
- name: connectionString
value: "Endpoint=sb://{ServiceBusNamespace}.servicebus.windows.net/;SharedAccessKeyName={PolicyName};SharedAccessKey={Key};EntityPath={ServiceBus}"
# Time in seconds to wait before auto deleting idle subscriptions. Used during subscription creation only. Default: `0` (disabled) (Optional)
#- name: autoDeleteOnIdleInSec
# value: "0"
# Consumer ID (a.k.a consumer tag) organizes one or more consumers into a group. Consumers with the same consumer ID work as one virtual consumer, i.e. a message is processed only once by one of the consumers in the group. If the consumer ID is not set, the dapr runtime will set it to the dapr application ID. (Optional)
#- name: consumerID
# value: "myconsumer"
# Default message time to live, in seconds. Used during subscription creation only. (Optional)
#- name: defaultMessageTimeToLiveInSec
# value: "10"
# When set to true, queues and subscriptions do not get created automatically. Default: 'false' (Optional)
#- name: disableEntityManagement
# value: "false"
# Timeout for invoking the app’s handler. Default: 60 (Optional)
#- name: handlerTimeoutInSec
# value: "60"
# Defines the length in seconds that a message will be locked for before expiring. Used during subscription creation only. Default set by server. (Optional)
#- name: lockDurationInSec
# value: "5"
# Defines the frequency at which buffered message locks will be renewed. Default: 20. (Optional)
#- name: lockRenewalInSec
# value: "20"
# Defines 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: 1000. (Optional)
#- name: maxActiveMessages
# value: "1000"
# Defines the maximum number of concurrent message handlers. Default: `0` (unlimited) (Optional)
#- name: maxConcurrentHandlers
# value: "0"
# Maximum 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 is 300 seconds (5 minutes). (Optional)
#- name: maxConnectionRecoveryInSec
# value: "300"
# Defines the number of attempts the server will make to deliver a message. Used during subscription creation only. Default set by server. (Optional)
#- name: maxDeliveryCount
# value: "10"
# Maximum 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 (Optional)
#- name: maxRetriableErrorsPerSec
# value: "10"
# Minimum interval (in seconds) to wait before attempting to reconnect to Azure Service Bus in case of a connection failure. (Optional)
#- name: minConnectionRecoveryInSec
# value: "2"
# Time in milliseconds for the initial exponential backoff when Azure Service Bus throttle messages. Defaults: `500` (Optional)
#- name: publishInitialRetryIntervalInMs
# value: "500"
# The max number of retries for when Azure Service Bus responds with "too busy" in order to throttle messages. Defaults: `5` (Optional)
#- name: publishMaxRetries
# value: "5"
# Timeout for sending messages and for management operations. Default: 60 (Optional)
#- name: timeoutInSec
# value: "60"

Authentication profiles

Available authentication profiles:

  • Connection string

  • Azure AD: Client credentials

  • Azure AD: Client certificate

Connection string

Authenticate using a connection string.

connectionString

Required - Shared access policy connection string for the Service Bus. Used for input binding direction. Used for output binding direction.

Example value: Endpoint=sb://{ServiceBusNamespace}.servicebus.windows.net/;SharedAccessKeyName={PolicyName};SharedAccessKey={Key};EntityPath={ServiceBus}

Azure AD: Client credentials

Authenticate using Azure AD with client credentials, also known as "service principals".

azureClientId

Required - Client ID (application ID)

Example value: c7dd251f-811f-4ba2-a905-acd4d3f8f08b

azureClientSecret

Required - Client secret (application password)

Example value: Ecy3XG7zVZK3/vl/a2NSB+a1zXLa8RnMum/IgD0E

azureTenantId

Required - ID of the Azure AD tenant

Example value: cd4b2887-304c-47e1-b4d5-65447fdd542a

namespaceName

Required - Parameter to set the address of the Service Bus namespace, as a fully-qualified domain name. Used for input binding direction. Used for output binding direction.

Example value: namespace.servicebus.windows.net

azureEnvironment

Optional name for the Azure environment if using a different Azure cloud

Default value: AzurePublicCloud

Example value: AzurePublicCloud

Allowed values:

  • AzurePublicCloud

  • AzureChinaCloud

  • AzureUSGovernmentCloud

Azure AD: Client certificate

Authenticate using Azure AD with a client certificate. "azureCertificate" is required.

azureClientId

Required - Client ID (application ID)

Example value: c7dd251f-811f-4ba2-a905-acd4d3f8f08b

azureTenantId

Required - ID of the Azure AD tenant

Example value: cd4b2887-304c-47e1-b4d5-65447fdd542a

namespaceName

Required - Parameter to set the address of the Service Bus namespace, as a fully-qualified domain name. Used for input binding direction. Used for output binding direction.

Example value: namespace.servicebus.windows.net

azureCertificate

Certificate and private key (in either a PEM file containing both the certificate and key, or in PFX/PKCS#12 format)

Example value:

-----BEGIN PRIVATE KEY-----\n MIIEvgI... \n -----END PRIVATE KEY-----
\n -----BEGIN CERTIFICATE----- \n MIICoTC... \n -----END CERTIFICATE----- \n

azureCertificatePassword

Password for the certificate if encrypted.

Example value: password

azureEnvironment

Optional name for the Azure environment if using a different Azure cloud

Default value: AzurePublicCloud

Example value: AzurePublicCloud

Allowed values:

  • AzurePublicCloud

  • AzureChinaCloud

  • AzureUSGovernmentCloud

Metadata

autoDeleteOnIdleInSec (number)

Time in seconds to wait before auto deleting idle subscriptions. Used during subscription creation only. Default: 0 (disabled)

Default value: 0

Example value: 3600

consumerID (string)

Consumer ID (a.k.a consumer tag) organizes one or more consumers into a group. Consumers with the same consumer ID work as one virtual consumer, i.e. a message is processed only once by one of the consumers in the group. If the consumer ID is not set, the dapr runtime will set it to the dapr application ID.

Example value: myconsumer

defaultMessageTimeToLiveInSec (number)

Default message time to live, in seconds. Used during subscription creation only.

Example value: 10

disableEntityManagement (bool)

When set to true, queues and subscriptions do not get created automatically. Default: 'false'

Default value: false

Example value: true

handlerTimeoutInSec (number)

Timeout for invoking the app’s handler. Default: 60

Default value: 60

Example value: 30

lockDurationInSec (number)

Defines the length in seconds that a message will be locked for before expiring. Used during subscription creation only. Default set by server.

Example value: 5

lockRenewalInSec (number)

Defines the frequency at which buffered message locks will be renewed. Default: 20.

Default value: 20

Example value: 20

maxActiveMessages (number)

Defines 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: 1000.

Default value: 1000

Example value: 2000

maxConcurrentHandlers (number)

Defines the maximum number of concurrent message handlers. Default: 0 (unlimited)

Default value: 0

Example value: 10

maxConnectionRecoveryInSec (number)

Maximum 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 is 300 seconds (5 minutes).

Default value: 300

Example value: 600

maxDeliveryCount (number)

Defines the number of attempts the server will make to deliver a message. Used during subscription creation only. Default set by server.

Example value: 10

maxRetriableErrorsPerSec (number)

Maximum 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 value: 10

Example value: 2

minConnectionRecoveryInSec (number)

Minimum interval (in seconds) to wait before attempting to reconnect to Azure Service Bus in case of a connection failure.

Default value: 2

Example value: 5

publishInitialRetryIntervalInMs (number)

Time in milliseconds for the initial exponential backoff when Azure Service Bus throttle messages. Defaults: 500

Default value: 500

Example value: 1000

publishMaxRetries (number)

The max number of retries for when Azure Service Bus responds with "too busy" in order to throttle messages. Defaults: 5

Default value: 5

Example value: 10

timeoutInSec (number)

Timeout for sending messages and for management operations. Default: 60

Default value: 60

Example value: 30