Azure Events Hub

Detailed documentation on the Azure Event Hubs pubsub component

Setup Azure Event Hubs

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.

Create a Dapr component

The next step is to create a Dapr component for Azure Event Hubs.

Create the following YAML file named eventhubs.yaml:

  1. apiVersion: dapr.io/v1alpha1
  2. kind: Component
  3. metadata:
  4. name: <NAME>
  5. namespace: <NAMESPACE>
  6. spec:
  7. type: pubsub.azure.eventhubs
  8. version: v1
  9. metadata:
  10. - name: connectionString
  11. value: <REPLACE-WITH-CONNECTION-STRING> # Required. "Endpoint=sb://****"
  12. - name: storageAccountName
  13. value: <REPLACE-WITH-STORAGE-ACCOUNT-NAME> # Required.
  14. - name: storageAccountKey
  15. value: <REPLACE-WITH-STORAGE-ACCOUNT-KEY> # Required.
  16. - name: storageContainerName
  17. value: <REPLACE-WITH-CONTAINER-NAME > # Required.

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

Warning

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

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.

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)