Azure IoT Hub转CosmosDB:自定义终结点分区键模板遥测字段语法问题
Azure IoT 消息路由自定义终结点分区键模板语法问题
我在Azure门户配置消息路由的*Custom Endpoint(自定义终结点)*时,设置了分区键模板,期望将遥测字段my_telemetry_date中的日期值追加到{deviceid}-之后,最终得到如下格式的分区键:
{"PartitionKey" : "FFFFFFFA-2023-10-22"}
遥测数据本身包含字段{"my_telemetry_date" : "2023-10-22"},但测试多种语法后,仅{deviceid}能被正确替换,my_telemetry_date的字段值始终无法被解析替换,具体尝试情况如下:
- 尝试语法:
{deviceid}-{Body.my_telemetry_date}
结果:{"PartitonKey" : "FFFFFFFA-{Body.my_telemetry_date}"}
- 尝试语法:
{deviceid}-{Body.<my_telemetry_date>}
结果:{"PartitonKey" : "FFFFFFFA-{Body.<my_telemetry_date>}"}
- 尝试语法:
{deviceid}-{<my_telemetry_date>}
结果:{"PartitonKey" : "FFFFFFFA-{<my_telemetry_date>}"}
- 尝试语法:
{deviceid}-<my_telemetry_date>
结果:{"PartitonKey" : "FFFFFFFA-<my_telemetry_date>"}
需要找到正确的分区键模板语法,以正常提取遥测消息体中的my_telemetry_date字段值。
内容的提问来源于stack exchange,提问作者Adrian Wreyford
相关产品推荐
相关产品推荐

