Azure Events Hub
Setup Azure Event Hubs
Create a Dapr component
The next step is to create a Dapr component for Azure Event Hubs.
Create the following YAML file named
apiVersion: dapr.io/v1alpha1 kind: Component metadata: name: <NAME> namespace: <NAMESPACE> spec: type: pubsub.azure.eventhubs version: v1 metadata: - name: connectionString value: <REPLACE-WITH-CONNECTION-STRING> # Required. "Endpoint=sb://****" - name: storageAccountName value: <REPLACE-WITH-STORAGE-ACCOUNT-NAME> # Required. - name: storageAccountKey value: <REPLACE-WITH-STORAGE-ACCOUNT-KEY> # Required. - name: storageContainerName 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.
WarningThe 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
For example, a Dapr app running on Kubernetes with
dapr.io/app-id: "myapp" will need an Event Hubs consumer group named
Apply the configuration
Visit this guide for instructions on configuring pub/sub components.