I am developing a MQTT service and I am confused when I design the topics. I think there are two ways to do this:
Topic
data/customer-aPayload
{"sensor-id":"23aafff2d23659cc97c557909de12f16","type":"demo","value":"hello world"}Topic
data/customer-a/23aafff2d23659cc97c557909de12f16Payload
{"type":"demo","value":"hello world"}
I wonder which is better. I think the first one may result in complexity when I need to subscribe message from a single sensor. Meanwhile, the topic data/customer-a is always under heavy load because of thousands of messages per second. And the second one has drawbacks too, obviously it makes the mqtt broker maintain a huge topic tree, I don't know whether it would cause significant performance degradation?
Which is better for thousands of devices of multiple customers?