Azure Service Bus:队列中没有消息,只有请求 [英] Azure Service Bus: No messages on queue, only requests
问题描述
我正在尝试使用服务总线队列作为Iot集线器端点将消息从IoT中心路由到功能应用程序.我发送到IoT中心的消息已在IoT中心中注册,但不会路由到服务总线队列.当我监视服务总线队列时,我只会看到成功的请求.
I'm trying to route messages from an IoT hub to a function app using a service bus queue as an Iot hub endpoint. The messages I send to the IoT hub are registered in the IoT hub, but won't be routed to the service bus queue. When I monitor the service bus queue, I only see successful requests.
我按照以下标准实施了两个路由规则:
I implemented two routing rules with the following criteria:
$._eventtype="meeting"
和
$body._eventtype="meeting"
我使用Azure提供的示例测试了第二个示例,它与之匹配. 他们似乎都没有将消息转发到服务总线.
I tested the second one with the example provided by Azure and it matched. Neither of them seem to forward the messages to the service bus.
在下面的示例消息中查找,我正在尝试路由该消息.
Find below a sample message, which I'm trying to route.
{"_room": "-----",
"_eventtype": "meeting",
"_temperature": 25,
"_building": "-----",
"_timestamp": "2018-01-24T11:08:13.056792Z",
"_humidity": 36,
"_id": 0}
推荐答案
您的消息正文的Routes表达式正确.看来,您的事件消息缺少内容类型和内容编码标头,请参阅更多详细信息
Your Routes expression for message body is correct. It looks like, your event message is missing a Content type and Content encoding headers, see more details here.
在这种情况下,当您的设备是MQTT直接连接时,请使用以下主题,例如Device1:
In the case, when your device is MQTT direct connected, use the following topic, example for Device1:
devices/Device1/messages/events/$.ce=utf-8&$.ct=application%2Fjson
对于Http连接的设备:
for Http connected device:
content-encoding:utf-8
content-type:application/json
这篇关于Azure Service Bus:队列中没有消息,只有请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!