Azure Event Hubs
To setup Azure Event Hubs pubsub create a component of type . See on how to create and apply a pubsub configuration.
Warning
The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets as described .
See here on how to get the Event Hubs connection string. Note this is not the Event Hubs namespace.
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
.
Azure IoT Hub provides an , so the Azure Event Hubs pubsub component can also be used to subscribe to Azure IoT Hub events.
The device-to-cloud events created by Azure IoT Hub devices will contain additional IoT Hub System Properties, and the Azure Event Hubs pubsub component for Dapr will return the following as part of the response metadata:
System Property Name | Description & Routing Query Keyword |
---|---|
iothub-connection-auth-generation-id | The connectionDeviceGenerationId of the device that sent the message. See . |
The connectionAuthMethod used to authenticate the device that sent the message. | |
iothub-connection-device-id | The deviceId of the device that sent the message. See IoT Hub device identity properties. |
iothub-connection-module-id | The moduleId of the device that sent the message. See . |
iothub-enqueuedtime | The enqueuedTime in RFC3339 format that the device-to-cloud message was received by IoT Hub. |
message-id | The user-settable AMQP messageId. |
{
'host': '127.0.0.1:3000',
'content-type': 'application/json',
'content-length': '120',
'iothub-connection-auth-generation-id': '637618061680407492',
'iothub-connection-auth-method': '{"scope":"module","type":"sas","issuer":"iothub","acceptingIpFilterRule":null}',
'iothub-connection-module-id': 'my-test-module-a',
'iothub-enqueuedtime': '2021-07-13T22:08:09Z',
'x-opt-sequence-number': '35',
'x-opt-enqueued-time': '2021-07-13T22:08:09Z',
'x-opt-offset': '21560',
'traceparent': '00-4655608164bc48b985b42d39865f3834-ed6cf3697c86e7bd-01'
- Basic schema for a Dapr component
- Read for instructions on configuring pub/sub components
- Pub/Sub building block