我需要丰富在事件网格上收到的设备生命周期事件[创建、删除、连接、断开]。我的解决方案中的事件流程如下:-
Device send registration request to IoT Hub -> Event grid triggers device life cycle event -> Event grid routes device life cycle event to Event Hub
.
由于我的应用程序,即消费者到事件中心,这就是我将所有事件从事件网格路由到事件中心的原因。现在,我需要丰富在事件中心收到的事件。例如,设备连接事件应如下所示:
{
"body": [
{
"id": "58b1872d-1388-8043-dacc-6322ca65d2bf",
"topic": "SOME_TOPIC",
"subject": "devices/diablo-central-park-1",
"eventType": "Microsoft.Devices.DeviceConnected",
"data": {
"deviceConnectionStateEventInfo": {
"sequenceNumber": "SOME_SEQ_NUMBER"
},
"hubName": "IOT_HUBNAME",
"deviceId": "DEVICE_ID"
},
"dataVersion": "",
"metadataVersion": "1",
"eventTime": "2020-10-16T06:33:42.2418032Z"
}
],
"properties": {
"aeg-output-event-id": "SOME_ID",
"aeg-subscription-name": "SOME_NAME,
"aeg-delivery-count": "0",
"aeg-data-version": "",
"aeg-metadata-version": "1",
"aeg-event-type": "Notification",
"enrichedProperty": "enrichedValue"
},
"offset": "25769816448",
"sequenceNumber": 2197,
"enqueuedTimeUtc": "2020-10-16T06:33:49.321Z",
""systemProperties": {}
}
因此,在上述事件 JSON 中,我应该enrichedProperty
在属性字段中获取。我已经通过门户上的 IoT 集线器刀片中的消息路由(丰富消息)对双更改事件、遥测进行了消息丰富。但是对于设备生命周期事件,我找不到方法。