Shared subscription

Hi all,

I have deployed EMQX version 5.5.0 for evaluation.

I enabled Authentication via MySQL (it works fine) and I enabled the Authorization using “File” as backend. Everything worked fine until I tried the shared subscription. So far I cannot have them working as explained in the documentation.

My configuration for the authorization is

{allow, {username, "TEST_USER"}, subscribe, ["$share/user_group_1/notifications/sensors/#"]}.

{allow, {username, "TEST_PUBLISHER"}, publish, ["/notifications/sensors/#"]}.

I am using mosquitto for testing using two subscribing clients (different ids). Something like

mosquitto_sub -h -i test_user_1 -u TEST_USER -P mysecretpassword -t /notifications/sensors/#
mosquitto_sub -h -i test_user_2 -u TEST_USER -P mysecretpassword -t /notifications/sensors/#

Then, when I published using

mosquitto_pub -h -i publisher_1 -u TEST_PUBLISHER -P mysecretpasswd2 -t /notifications/sensors/121212 -m "{'status': 'all good'}" -k 120

both subscribed clients receive the message. Based on the documentation, using shared subscriptions, only one should receive the message (the shared subscription delivery method is set to round robin).

Someone can help please to figure out where I am mistaken?
Thank you in advance for any advise.



In order to use shared subscription, the clients must subscribe to a topic with $share prefix, $share//notifications/sensors/# in your case.

BTW, leading / in the topic name is not needed, it creates an empty topic level.