按消息类型将事件中心消息路由到Azure功能

编程入门 行业动态 更新时间:2024-10-28 08:17:28
本文介绍了按消息类型将事件中心消息路由到Azure功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我已经创建了一个Azure函数来侦听Azure IoT中心实例.当我向IoT中心发布消息时,我会像这样设置属性:

I've create an Azure Function to listen to an Azure IoT Hub instance. When I post message to the IoT Hub I set a property like so:

Message iotMessage = new Message([myMessage]); iotMessage.Properties.Add("Type", [MessageType]);

在Azure Function端,我希望Azure函数仅接收/处理具有Type属性并且Type属性等于"MessageType1"的消息.

At the Azure Function end I want the Azure function only to receive/process messages that have a Type property and where the Type property equals "MessageType1".

我看不到Azure函数中执行此操作的方法.有人可以建议这样做吗?

I cannot see a way to do this in an Azure function. Can someone advise if this is possible?

推荐答案

编辑:这似乎是您要查找的内容:

this appears to be what you're looking for:

"> docs.microsoft/zh-cn/azure/iot-hub/iot-hub-csharp-csharp-process -d2c#向您的iot轮毂添加队列并向其发送路由消息

您的条件将为Type = MessageType1,并且您将使函数触发器脱离输出队列.

Your condition would be Type=MessageType1 and you would have the function trigger off of the output queue.

您为Azure函数使用哪种类型的输入绑定?

What type of input binding are you using for your Azure Function?

AFAIK,目前无法一步完成.但是,您有一些选择:

AFAIK, this isn't currently possible in one step. However, there are a few options you have:

  • 将IoT中心连接到ServiceBus主题/订阅,这使您可以根据属性进行一些过滤.触发按MessageType1过滤的订阅
  • 具有专用于过滤IoT中心消息的功能.当它与MessageType1消息匹配时,将该消息放入队列.此队列触发另一个仅处理匹配消息的功能

更多推荐

按消息类型将事件中心消息路由到Azure功能

本文发布于:2023-11-07 14:38:54,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1566717.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:消息   路由   类型   事件   功能

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!