Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] Unable to confirm delivery without setting messageArrived callback

Thank you for your reply Ian.


I was not thinking in servers sending unsolicited messages but clients only sending messages. I mean, it would be a real use case to have a device (temperature sensor for example) that only wants to publish data to the broker. In that cases it would be a waste of time/resources to have a callback for received messages since we know that the devices shouldn’t receive anything (actually it could be solved configuring an empty function as messageArrived callback, but it is estrange for me to have in my code an empty function that simply does nothing).


I don’t know if we are talking about the same use case.


Thank you so much for your time.


Adrián M.


De: paho-dev-bounces@xxxxxxxxxxx [mailto:paho-dev-bounces@xxxxxxxxxxx] En nombre de Ian Craggs
Enviado el: viernes, 07 de octubre de 2016 16:46
Para: paho-dev@xxxxxxxxxxx
Asunto: Re: [paho-dev] Unable to confirm delivery without setting messageArrived callback


Hi Adrian,

that was a deliberate decision on my part.  If no messageArrived callback is set, then no incoming messages can be sent to the application.  This would cause the library a dilemma, so I felt it a good idea to insist on a messageArrived callback being implemented. 

Also, I do know that some MQTT servers can send unsolicited messages to a client.



On 09/23/2016 10:31 AM, Moran Adrian wrote:

Hi all,

with the current version of C Paho client is not possible to confirm messages delivery without setting the messageArrived callback.


File src/MQTTAsync.c --> Function MQTTAsync_setCallbacks()



if (m == NULL || ma == NULL || m->c->connect_state != 0)




m->context = context;

m->cl = cl;

m->ma = ma;

m->dc = dc;




Why is needed ma (messageArrived) callback to be set to work with dc (deliveryComplete) callback? I will just replace if condition by the following one:


if (m == NULL || m->c->connect_state != 0)


I think that subscription and publication are completely independent tasks, so I don’t know if it is a bug or something I don’t have clear enough.


Thank you so much,

Adrián M.

paho-dev mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit

Ian Craggs                          
icraggs@xxxxxxxxxx                 IBM United Kingdom
Paho Project Lead; Committer on Mosquitto

Back to the top