我正在将本机MQTT与Azure IoT中心一起使用。潜在的问题是,一旦将有效负载路由到Blob存储,它将被编码为Base64。我认为这是由于缺少系统属性“ contentType = UTF-8”。
我尝试使用以下主题没有成功:
devices/test/messages/events/contentEncoding=UTF-8&contentType=application/json
devices/test/messages/events/contentEncoding=UTF-8
devices/test/messages/events/contentEncoding=UTF-8&contentType=applicationjson
devices/test/messages/events/.contentEncoding=UTF-8
这会将这两项放入“属性”巢中,该巢独立于“系统属性”巢(请参阅下文)。
{"EnqueuedTimeUtc":"2019-07-31T19:24:57.4290000Z","Properties":{"contentEncoding":"UTF-8","contentType":"applicationjson"},"SystemProperties":{"connectionDeviceId":"test","connectionAuthMethod":"{\"scope\":\"device\",\"type\":\"sas\",\"issuer\":\"iothub\",\"acceptingIpFilterRule\":null}","connectionDeviceGenerationId":"000","enqueuedTime":"2019-07-31T19:24:57.4290000Z"},"Body":"msginbase64insteadofutf8"}
我尝试根据此处描述的“通用格式”来格式化消息,但也没有成功:https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-routing-query-syntax#message-routing-query-based-on-message-properties
答案 0 :(得分:1)
以下是发布者主题和系统属性的示例*:
devices/test/messages/events/$.ct=application%2Fjson&$.ce=utf-8