dapr / components-contrib

Community driven, reusable components for distributed apps
Apache License 2.0
550 stars 482 forks source link

Not all system properties available while subscribing to Azure IoT Hub Events #1151

Open arkakk93 opened 3 years ago

arkakk93 commented 3 years ago

Expected Behavior

Should be able to extract additional system properties for D2C IoT Hub messages from the delivered HTTP subscription message Example: message-id (Reference: https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-messages-construct#system-properties-of-d2c-iot-hub-messages)

Actual Behavior

Currently the only supported list of system properties is listed here: https://docs.dapr.io/reference/components-reference/supported-pubsub/setup-azure-eventhubs/#subscribing-to-azure-iot-hub-events

CodeMonkeyLeet commented 3 years ago

Seems like a reasonable extension of #227 to include user settable IoT Hub system properties.

CodeMonkeyLeet commented 3 years ago

The existing EventHubs bindings implementation exposes all the Event.SystemProperties extracted by the azure-event-hubs-go/v3 SDK, with the expectation that additional properties should be retrievable from the Annotations map but a cursory check using just az CLI simulated events don't generate any additional properties, so this will need custom events generated to test those fields specifically.

@arkakk93 Do you any details for how you're setting the device messages so we can look at replicating this?

CodeMonkeyLeet commented 3 years ago

Summarizing some investigation into SystemProperties of D2C IoT Hub messages not explicitly handled by Dapr EventHubs components:

As a side note, it turns out that az iot device simulate can actually simulate the properties in question, for example:

az iot device simulate -n my-iothub -d my-test-device --msg-count 2 --msg-interval 1 --protocol http --properties "iothub-userid=my-user-id-value;iothub-messageid=my-message-id-value;dt-subject=my-digital-twin-id"

Enumerating some of the less obvious SystemProperties that can be passed to --properties:

artursouza commented 3 years ago

/cc @mukundansundar

arkakk93 commented 3 years ago

The existing EventHubs bindings implementation exposes all the Event.SystemProperties extracted by the azure-event-hubs-go/v3 SDK, with the expectation that additional properties should be retrievable from the Annotations map but a cursory check using just az CLI simulated events don't generate any additional properties, so this will need custom events generated to test those fields specifically.

@arkakk93 Do you any details for how you're setting the device messages so we can look at replicating this?

I am directly relying on the messages generated by the Azure IoT Hub. These are routed to the Event Hubs and then subscribed too

arkakk93 commented 3 years ago

Along with system properties, similar thing was observed for the Properties. When using Azure IoT Hub, the Enrichment details are sent to the Event Hub event as Properties. These are currently not available with Dapr

arkakk93 commented 3 years ago
  • message-id

@CodeMonkeyLeet, having the message-id will at least unblock us

dapr-bot commented 3 years ago

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged (pinned, good first issue, help wanted or triaged/resolved) or other activity occurs. Thank you for your contributions.

CodeMonkeyLeet commented 3 years ago

Removing stale tag and updating:

dapr-bot commented 2 years ago

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged (pinned, good first issue, help wanted or triaged/resolved) or other activity occurs. Thank you for your contributions.

dapr-bot commented 2 years ago

This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as pinned, good first issue, help wanted or triaged/resolved. Thank you for your contributions.

uriel-kluk commented 10 months ago

Is it possible to include dt-dataschema in all non-telemetry events as well?

We're in the process of automating our digital twin migration. Due to the unpredictable order of events, we often encounter telemetry or device twin change events. Creating a new digital twin with the correct ModelId becomes challenging when the model is not available in the event. Having dt-dataschema included in every event could simplify this process and help avoid race conditions.