简体   繁体   English

如何使用 Azure IOT HUB 订阅 mqtt 代理上的主题,因为我希望在发布主题时将数据存储在 Azure iot hub 中

[英]How to subscribes to topic on mqtt broker with Azure IOT HUB as i want the data to be stored in Azure iot hub when I published my topic

im new to mqtt and currently trying to setup a mqtt protocol to send data from a gateway devices to azure iot hub.我是 mqtt 新手,目前正在尝试设置 mqtt 协议以将数据从网关设备发送到 azure 物联网集线器。 The problem i facing was I couldn't figure out which way that I can received and store data on IoT Hub when i published my data on mqtt broker.我面临的问题是,当我在 mqtt 代理上发布我的数据时,我无法弄清楚我可以通过哪种方式在 IoT Hub 上接收和存储数据。 The textbook way is to subscribe the mqtt broker using Azure IOT Hub but how should I do it?教科书的方法是使用 Azure IOT Hub 订阅 mqtt 代理,但我该怎么做呢?

Assuming I am doing testing using a laptop假设我正在使用笔记本电脑进行测试

Read data stored in json file -> published to topic "data/device1" -> Data stored in Azure IoT Hub读取存储在 json 文件中的数据 -> 发布到主题“data/device1” -> 存储在 Azure IoT Hub 中的数据

I tried reading the Azure IoT HUB MQTT Connections but it doesnt work out for me.我尝试阅读 Azure IoT HUB MQTT Connections 但它对我不起作用。 PLease Help请帮忙

By default Azure IoT Hub makes incoming telemetry messages available on its Event Hub-compatible endpoint: https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-messages-read-builtin It does not matter over which protocol (MQTT, AMQP or HTTPS) you sent in the messages to IoT Hub - they all will land in that endpoint.默认情况下,Azure IoT 中心在其与事件中心兼容的端点上提供传入的遥测消息: https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-messages-read-builtin无论您通过哪种协议(MQTT、AMQP 或 HTTPS)向 IoT 中心发送消息 - 它们都将到达该端点。

From there you can read the information using HTTPS or AMQP.从那里您可以使用 HTTPS 或 AMQP 读取信息。 I would recommend to use the Event Hub SDK or use a stream processing service like Azure Stream Analytics or Spark Streaming, which supports Event Hub directly. I would recommend to use the Event Hub SDK or use a stream processing service like Azure Stream Analytics or Spark Streaming, which supports Event Hub directly.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM