Azure IoT Hub with MQTT Devices

Red255 71 Reputation points
2022-01-25T11:07:25.42+00:00

Hi I'm looking for guidance on the use of MQTT with IoT hub. As mentioned in my previous posts I am trying to get my existing MQTT devices to publish data to IoT hub which appears to be failing because the message topics do not follow the prescribed structure which should be devices/DEVICE_ID/messages/events/topic/. As it is impossible to change the existing devices in anyway I need to find a way to make this work. As far as I can see there are two options (1) running a MQTT broker or (2) Protocol Gateway. Have I missed any other possibilities?

If I consider a MQTT broker what is the best way to implement this in Azure how should I host it how does it fit in with IoT hub?

If I consider protocol Gateway can this effectively replace the MQTT topics in a received message with one in the correct format?

Any advice on this would be great I am looking for the most stable, robust and low overhead solution.

Azure IoT Hub
Azure IoT Hub
An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
1,127 questions
0 comments No comments
{count} votes

Accepted answer
  1. António Sérgio Azevedo 7,666 Reputation points Microsoft Employee
    2022-01-25T16:14:26.253+00:00

    Hello @Red255 this relates with your previous question: https://learn.microsoft.com/en-us/answers/questions/707773/mqtt-message-structure.html

    As far as I can see there are two options (1) running a MQTT broker or (2) Protocol Gateway. Have I missed any other possibilities?

    That is correct. Azure IoT protocol gateway or Using the MQTT broker in IoT Edge are the recommendations.

    Update: ** Though since Using the MQTT broker in IoT Edge is still in **preview, if you will use IoT Edge the recommendation for production is to deploy an OSS MQTT broker like Mosquitto as a module. This is a good example you can follow for your implementation: Azure IoT Edge Identity Translation Lite: Sample on implementing Identity Translation at the edge

    If I consider a MQTT broker what is the best way to implement this in Azure how should I host it how does it fit in with IoT hub?

    You can leverage Azure IoT Edge acting as an MQTT broker. The How-To guide Publish and subscribe with Azure IoT Edge (preview) will help you get started.

    If I consider protocol Gateway can this effectively replace the MQTT topics in a received message with one in the correct format?

    Yes, it will work.

    "The Azure IoT protocol gateway is a framework for protocol adaptation that is designed for high-scale, bidirectional device communication with IoT Hub. You can deploy the protocol gateway in Azure in a highly scalable way by using Azure Service Fabric, Azure Cloud Services worker roles, or Windows Virtual Machines."

    Despite "the protocol gateway can be deployed in on-premises environments, such as field gateways" I would recommend that you use the MQTT broker in IoT Edge instead.

    Remember:

    • Please accept an answer if correct. Original posters help the community find answers faster by identifying the correct answer. Here is how.
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification.
    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful