However given that you are talking about the application level, it seems
like a problem that is not specific to MQTT.
The MQTT 3.1.1 specification states:
- The Server MUST allow ClientIds which are between 1 and 23 UTF-8
encoded bytes in length
- The Server MAY allow ClientId’s that contain more than 23 encoded
bytes.
- A Server MAY allow a Client to supply a ClientId that has a length of
zero bytes.
If you are using embedded devices, could you use the MAC address of the
device?
I suspect most MQTT server implementations will accept 32-characters,
which would allow you to use UUIDs - which were designed for the purpose
of decentrally creating unique identifiers.
create really unique application-level ids and transmit them through MQTT.