The documentation you are viewing is for Dapr v0.11 which is an older version of Dapr. For up-to-date documentation, see the latest version.
Azure Events Hub
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
:
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.
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.