0

I am using eclipse-mosquitto:1.6.9 and would like to remap incoming messages to topic /registration_app to /$share/registration_app.

In this case IoT devices will be publishing registration messages to /registration_app & backend ap will be listening and processing each request. To scale backend process horizontally, I want to switch to /$share/registration_app (MQTT V5.0) for backend process, but don't want to change original incoming message topic /registration_app.

SO far I can see remapping is available in case of bridging. So would like to know if I can do remapping without bridge.

1 Answer 1

1

First, it is really bad practice to start topics with leading /. It adds a null entry to the start of the topic tree and causes problems with things like shared subscriptions (we will get to that next).

Second, I think you have miss understood how shared subscriptions work. Topics that start with $share/ (note the lack of leading /) are used to set up shared subscription groups, so groups of clients can load balance the consuming of messages published to a give topic pattern. You don't do any topic remapping yourself.

To set up a shared subscription group you subscribe to a topic as follows:

$share/<groupname>/<topic>

So in your case assuming a group called backend and messages published to 'registration_app' (again note the lack of leading /) it would be

$share/backend/registration_app

If you use a leading / on the original topic you have to insert a double / in the shared subscription topic to insert the null, so just don't do it.

$share/backend//registration_app

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.