Azure Events Hub

Detailed documentation on the Azure Event Hubs pubsub component

Component format

To setup Azure Event Hubs pubsub create a component of type pubsub.azure.eventhubs. See this guide on how to create and apply a pubsub configuration.

  1. apiVersion: dapr.io/v1alpha1
  2. kind: Component
  3. metadata:
  4. name: eventhubs-pubsub
  5. namespace: default
  6. spec:
  7. type: pubsub.azure.eventhubs
  8. version: v1
  9. metadata:
  10. - name: connectionString
  11. value: "Endpoint=sb://{EventHubNamespace}.servicebus.windows.net/;SharedAccessKeyName={PolicyName};SharedAccessKey={Key};EntityPath={EventHub}"
  12. - name: storageAccountName
  13. value: "myeventhubstorage"
  14. - name: storageAccountKey
  15. value: "112233445566778899"
  16. - name: storageContainerName
  17. value: "myeventhubstoragecontainer"

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

FieldRequiredDetailsExample
connectionStringYConnection-string for the Event Hubs“Endpoint=sb://{EventHubNamespace}.servicebus.windows.net/;SharedAccessKeyName={PolicyName};SharedAccessKey={Key};EntityPath={EventHub}”
storageAccountNameYStorage account name to use for the EventProcessorHost“myeventhubstorage”
storageAccountKeyYStorage account key to use for the EventProcessorHost. Can be secretKeyRef to use a secret reference“112233445566778899”
storageContainerNameYStorage container name for the storage account name.“myeventhubstoragecontainer”

Create an Azure Event Hub

Follow the instructions here on setting up Azure Event Hubs. Since this implementation uses the Event Processor Host, you will also need an Azure Storage Account. Follow the instructions here to manage the storage account access keys.

See here on how to get the Event Hubs connection string. Note this is not the Event Hubs namespace.

Create consumer groups for each subscriber

For every Dapr app that wants to subscribe to events, create an Event Hubs consumer group with the name of the dapr id. For example, a Dapr app running on Kubernetes with dapr.io/app-id: "myapp" will need an Event Hubs consumer group named myapp.

Note: Dapr passes the name of the Consumer group to the EventHub and so this is not supplied in the metadata.

Related links

Last modified March 18, 2021: Merge pull request #1321 from dapr/aacrawfi/logos (9a399d5)