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

Hi Ian,

As you say in your first response, there is no server (broker) that sends unsolicited messages to clients so the library should discard directly any message that has not been solicited beforehand.

 

I am also agree with you that an empty function (not null handler) does not incur much overhead (it returns directly), but I think the correct way would be allowing to set a null handler (as the documentation says), since it is possible to have a node that only wants to publish messages and does mind any received messages (in case unsolicited messages arrive)

 

Summarizing, I think it is a conceptual issue more than a technical one.

 

Thanks for your responses Ian.

Adrián M.

 

De: paho-dev-bounces@xxxxxxxxxxx [mailto:paho-dev-bounces@xxxxxxxxxxx] En nombre de Ian Craggs
Enviado el: miércoles, 12 de octubre de 2016 18:09
Para: paho-dev@xxxxxxxxxxx
Asunto: Re: [paho-dev] Unable to confirm delivery without setting messageArrived callback

 

Hi Adrian,

I understand what you're saying.   I'm not sure what the client library would do if it received a message and no handler were defined.  A null handler doesn't incur much overhead does it?

Ian

 

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

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.

Ian

 

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)

rc = MQTTASYNC_FAILURE;

else

{

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
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev




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




_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev



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

Back to the top