1
votes

I set up an architect for my solution think that iot hub does the work of an mqtt broker, but when I started the implementation , I found that you cannot subscribe to a specific subject to retrieve messages published by another mqtt client, the notion of topic does not exist on iot hub.

I have read several articles about this subject but I have not found an appropriate alternative. Iot hub has only two topics, and event hub endpoints are limited to 10 endpoints Can you guide me or suggest a solution with a broker? How can I subscribe to a specific topic?

I want a device to device communication with pub / sub

Example: a device publishes on a topic / home / room another device subscribes to / home / room using iot hub

I am open to all proposals

Thank you

1
this document is not helpful for me, for this reason i post in stackoverflowYou La

1 Answers

2
votes

Cloud development

IoT Hub has a limited MQTT broker implementation, because of that, you can't subscribe to device topics from other devices. You could use an Azure Function to catch all your messages and decide if it needs to send a Cloud to Device message. You could also leverage Stream Analytics to decide if a message needs to be sent before talking to that Function. This is probably your best bet if you want to play by Azure IoT Stack's rules.

No cloud development

If you really want your devices to listen to each other, there is an old blog post that describes a scenario where a device uses the service SDK to listen to messages sent to IoT Hub by a different device. It lists the pros and cons in the post.

Custom edge module

If your devices are on the same network, you could build an Edge Module that implements an MQTT broker. The devices would then connect to the edge device as they would in a normal gateway scenario, but also to your custom broker. In your routing, you would then send all the messages to your custom broker to be transmitted to any devices listening to that topic, while still sending the data to the cloud. I imagine their are a few security risks you want to look into if you go in this direction.

So in short: it's possible, probably in many other ways, but in the end you are leveraging a cloud platform that doesn't support this natively.