Azure Event Hubs binding spec

Detailed documentation on the Azure Event Hubs binding component

Component format

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

See this for instructions on how to set up an Event Hub.

  1. apiVersion: dapr.io/v1alpha1
  2. kind: Component
  3. metadata:
  4. name: <NAME>
  5. namespace: <NAMESPACE>
  6. spec:
  7. type: bindings.azure.eventhubs
  8. version: v1
  9. metadata:
  10. - name: connectionString # Azure EventHubs connection string
  11. value: "Endpoint=sb://****"
  12. - name: consumerGroup # EventHubs consumer group
  13. value: "group1"
  14. - name: storageAccountName # Azure Storage Account Name
  15. value: "accountName"
  16. - name: storageAccountKey # Azure Storage Account Key
  17. value: "accountKey"
  18. - name: storageContainerName # Azure Storage Container Name
  19. value: "containerName"
  20. - name: partitionID # (Optional) PartitionID to send and receive events
  21. value: 0

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

FieldRequiredBinding supportDetailsExample
connectionStringYOutputThe EventHubs connection string. Note that this is the EventHub itself and not the EventHubs namespace. Make sure to use the child EventHub shared access policy connection string“Endpoint=sb://**
consumerGroupYOutputThe name of an EventHubs Consumer Group to listen on“group1”
storageAccountNameYOutputThe name of the account of the Azure Storage account to persist checkpoints data on“accountName”
storageAccountKeyYOutputThe account key for the Azure Storage account to persist checkpoints data on“accountKey”
storageContainerNameYOutputThe name of the container in the Azure Storage account to persist checkpoints data on“contianerName”
partitionIDNOutputID of the partition to send and receive events0

Binding support

This component supports output binding with the following operations:

  • create

Input Binding to Azure IoT Hub Events

Azure IoT Hub provides an endpoint that is compatible with Event Hubs, so Dapr apps can create input bindings to read Azure IoT Hub events using the Event Hubs bindings component.

The device-to-cloud events created by Azure IoT Hub devices will contain additional IoT Hub System Properties, and the Azure Event Hubs binding for Dapr will return the following as part of the response metadata:

System Property NameDescription
iothub-connection-auth-generation-idThe connectionDeviceGenerationId of the device that sent the message. See IoT Hub device identity properties.
iothub-connection-auth-methodThe authentication method used to authenticate the device that sent the message.
iothub-connection-device-idThe deviceId of the device that sent the message. See IoT Hub device identity properties.
iothub-connection-module-idThe moduleId of the device that sent the message. See IoT Hub device identity properties.
iothub-enqueuedtimeThe date and time in RFC3339 format that the device-to-cloud message was received by IoT Hub.

For example, the headers of a HTTP Read() response would contain:

  1. {
  2. 'user-agent': 'fasthttp',
  3. 'host': '127.0.0.1:3000',
  4. 'content-type': 'application/json',
  5. 'content-length': '120',
  6. 'iothub-connection-device-id': 'my-test-device',
  7. 'iothub-connection-auth-generation-id': '637618061680407492',
  8. 'iothub-connection-auth-method': '{"scope":"module","type":"sas","issuer":"iothub","acceptingIpFilterRule":null}',
  9. 'iothub-connection-module-id': 'my-test-module-a',
  10. 'iothub-enqueuedtime': '2021-07-13T22:08:09Z',
  11. 'x-opt-sequence-number': '35',
  12. 'x-opt-enqueued-time': '2021-07-13T22:08:09Z',
  13. 'x-opt-offset': '21560',
  14. 'traceparent': '00-4655608164bc48b985b42d39865f3834-ed6cf3697c86e7bd-01'
  15. }

Last modified September 20, 2021 : Merge pull request #1800 from greenie-msft/gRPC_proxying_video (36dff3c)