docs/howto/setup-pub-sub-message-broker/setup-azure-eventhubs.md

1.6 KiB

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
  metadata:
  - name: connectionString
    value: <REPLACE-WITH-CONNECTION-STRING> # Required.
  - 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.

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

Apply the configuration

In Kubernetes

To apply the Azure Event Hubs pub/sub to Kubernetes, use the kubectl CLI:

kubectl apply -f eventhubs.yaml

Running locally

The Dapr CLI will automatically create a directory named components in your current working directory with a Redis component. To use Azure Event Hubs, replace the contents of pubsub.yaml (or messagebus.yaml for Dapr < 0.6.0) file with the contents of eventhubs.yaml above (Don't change the filename).