Hi! I'm developing a network application which has the following structure:
Listener thread, which calls mosquitto_loop_start and mosquitto_message_callback_set to work with input messages and answer some information by mosquitto_publish.
Publishing thread, which sends some information to MQTT topic by mosquitto_publish every minute.
The callback which is called when a listener thread receives a message processes the request, and this processing can take some time, let's say 30 seconds. Will this callback block work of publishing thread? For example, callback is processing the request right now. At this moment, publishing thread calls mosquitto_publish to send its message. Will this message be sent immediately or only after returning of listener callback?
P.S. This question is important to create a proper architecture. I want to understand that do I need to create one more thread, which will be used as message processor and will receive information from listener thread by some IPC to free callback from request processing, and it will return as fast as possibly to don't block publishing thread. Or I am wrong and callback from mosquitto_message_callback_set doesn't block mosquitto_publish call, the message will be sent without delays and it's unimportant how much time the callback works with request.
P.S.S. Is it correct behavior to process request inside the callback? Or it's better to give request processing to another thread and free callback work faster? Maybe two-threads will increase the application speed somehow, but I'm not pretty sure, because request processing is single-thread anyway, It depends on libmosquitto internal work and I want to understand that will callback block mosquitto message receiving, sending and so on or not.