Azure IoT Central Data Export to Event Hub - Configuring Partition Key Through Data Transformation

MesoMat Co 6 Reputation points
2022-08-29T16:18:46.947+00:00

I'm using Azure IoT Central's data export to Event Hubs feature with a data transformation, and I would like to set a partition key that the Event Hub will use. I want to make it so that all the events from one device end up on the same Event Hub partition.
What is the correct way to do this? What do I have to do within IoT Central to get my intended partitioning to work properly?

I have tried passing a field called "PartitionKey" in the transformed event body:
235805-image.png

{  
    "Measurement": 1.7845966827179327e+308,  
    "PartitionKey": "hrhp2uttrli1",  
    "TimeEnqueued": "1948-11-15T20:07:30.267714401Z",  
    "deviceId": "hrhp2uttrli1",  
    "module": null  
}  

This does not make it so that all events from one device go to the same Event Hub partition.

Thanks!

Azure IoT Central
Azure IoT Central
An Azure hosted internet of things (IoT) application platform.
359 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Roman Kiss 2,246 Reputation points
    2022-09-02T21:40:03.017+00:00

    Hi @MesoMat Co ,

    Basically, there are two workarounds for your requirement such as sending the telemetry data to the specific EH partition based on the deviceId, etc.

    1. Using the webhook destination endpoint to send an event to a specified partition in an Event Hub, see here. The Data Transformation will massage the event payload and also a rule for selecting a destination endpoint for each partition. Note, that currently we can not populate a destination endpoint parameters (url, headers, etc.) dynamically, all configuration must be explicitly setup it. Please, vote for this feature here.
    2. Exporting the device telemetry data to the Azure Event Grid as a cloudevents message (via the custom topic) and then delivering to the specific partition in the Event Hub, see here. Using the subscription advanced filtering, the events can be filtered based on the needs. Note, that the AEG model doesn't guarantee delivering events in order.

    Thanks
    Roman

    2 people found this answer helpful.