如何使用路由查询将消息路由到服务总线队列? [英] How to route message to Service bus queue using routing query?

查看:82
本文介绍了如何使用路由查询将消息路由到服务总线队列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个IoT中心,该中心具有连接的设备,可以发送遥测消息.我想分别从每个设备读取消息,因此我决定为每个设备创建一个不同的终结点.为了对消息进行排序,我将路由与查询一起使用,但是当我向路由添加查询规则时,消息将停止到达端点.连接的设备使用MQTT.

I have an IoT hub with connected devices which sends telemetry messages. I want to read messages from each device separately, so I decided to create a different endpoint for each device. For sorting messages I use routes with query, but when I add a query rule to the route, messages stop going to the endpoint. Connected device uses MQTT.

以下是屏幕截图:

  • Endpoint
  • Routes
  • toMyEndpoint route

推荐答案

您的查询表达式正确.

但是请确保您按如下所示设置内容类型和内容编码:

But make sure you set content type and content encoding like this:

Message eventMessage = new Message(Encoding.UTF8.GetBytes("{\"boarded\":\"0\"}"));
eventMessage.ContentType = "application/json";
eventMessage.ContentEncoding = "utf-8";

对我有用.

这篇关于如何使用路由查询将消息路由到服务总线队列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆