Can I isolate users with de "Topic Rewrite"?

Hello, I am trying to isolate the different clients so that each one sees a different root. For example, I want “user1” when publishing to “x/y/z” to actually publish to “user1/x/y/z” and when subscribing to “A/B/C” to actually subscribe to “user1/A/B/C”, in a completely transparent way. Is it possible to achieve this mode of operation using “Topic Rewrite”?


Yes, you can isolate users with “Topic Rewrite” in EMQX:

For Publishing: Rewrite topics so “user1” publishing to “x/y/z” maps to “user1/x/y/z”.

For Subscribing: Rewrite topics so “user1” subscribing to “A/B/C” maps to “user1/A/B/C”.

Using Mountpoints: Create a listener with a specific mountpoint for each user, e.g., "user1/"​ (EMQX & MQTT Forum)​​ (EMQX & MQTT Forum)​.

This ensures that each user’s topics are isolated and prefixed with their username transparently.

Thank you

Ok, this metod can work, but this method forces us to use a different TCP port for each user, which is not possible!.

Anyway, thank you for your reply.