How to subscribe the data in azure iot hub to device using Mosquitto broker

A Arockia Jabamalai Eldsin 20 Reputation points
2023-07-07T08:28:21.9133333+00:00

Hi,

This is Arockia, I am working in the MQTT for sending and receiving data from Azure IOT hub to device. I can send a data from Device to Azure IOT hub.User's image

but whatever data's send to Azure IOT hub that all I want to subscribe from another device. That area I can't see the msg. I can't connect with the Azure server.

First we are sending data from IOT device to UI successfully. Then we are sending data from UI to IOT device using Api and receiving data in IOT device. we want to display the received data in console using MQTT broker. But we are not able to display it in console.

Can You say what i need to do for the mosquitto_sub to receive the data from IOT hub to device.

Thanks,

Arockia

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

1 answer

Sort by: Most helpful
  1. Sander van de Velde | MVP 36,766 Reputation points MVP Volunteer Moderator
    2023-07-07T14:15:44.9533333+00:00

    Hello @A Arockia Jabamalai Eldsin ,

    thanks for visiting our moderated community forum.

    The Azure IoT Hub is a cloud gateway for ingesting IoT Device telemetry.

    The IoT Hub comes with impressive features like device registration (each device has its own identity), tagging of metadata, rule bases message routing, message enrichment, and even cloud-to-device communication using synchronous direct methods or asynchronous desired properties in the device twin.

    The IoT Hub supports MQTT as a transport protocol (next to AMQP and HTTP) but it's not an MQTT broker. Topics are hidden from the actual message pass-through.

    So, if you want to use the IoT Hub for distributing messages between devices, you need to add custom logic (like an Azure Function) and listen for incoming messages (there is an Azure Function IoT Hub trigger) and in the logic, you send a cloud message, set a desired property or try to call a direct method on the target devices of your choice.

    If you are looking for full MQTT Broker functionality in the Azure cloud, check out the Event Grid MQTT support which is now in public preview.

    Control your MQTT clients using the request-response (one-to-one) messaging pattern. This pattern enables any client to communicate with any other client without restrictions, regardless of the clients' roles. Broadcast alerts to a fleet of clients using the one-to-many messaging pattern. This pattern enables the application to publish only one message that the service replicates for every interested client.

    This new service seems to meet your requirements.


    If the response helped, do "Accept Answer". If it doesn't work, please let us know the progress. All community members with similar issues will benefit by doing so. Your contribution is highly appreciated.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.