

This creates multiple callbacks to process messages from different topics. The better way to do this is to use the message_callback_add(sub, callback) function of the client object. Then you can create if conditions to process the messages accordingly. One way to do this is by using the message.topic attribute to check which topic is the message published to. If you have multiple messages being received from different topics and need to process each topic’s message in a different way then we have to sort the messages.


