Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] java: publishing from the callback

Julien, Benjamin,

the javadoc for messageArrived is not quite right.  It is true you can publish messages within the messageArrived callback when used with the MqttAsyncClient, but you can't if you use MqttClient.

The MqttClient class was intended to simplify MQTT application programming.  As a consequence it's less flexible than the MqttAsyncClient class.   We need to update the Javadoc.

Ian


On 03/13/2014 04:01 PM, Dave Locke wrote:
in messageArrived the application must return control as quickly as possible.  If it blocks any new inbound messages will not be processed.  Publishing using the non blocking i.e. async client within the messageArrived is fine.   But do not wait for completion of the publish within messageArrived using blocking methods like waitforcompletion.


All the best
Dave

 



From:        Benjamin Cabé <benjamin@xxxxxxxxxxx>
To:        General development discussions for paho project <paho-dev@xxxxxxxxxxx>
Date:        13/03/2014 11:37
Subject:        Re: [paho-dev] java: publishing from the callback
Sent by:        paho-dev-bounces@xxxxxxxxxxx





Hi,

Any hints on this? Julien and I are finalizing the MQTT Tutorial for
EclipseCon and it¹s too bad that messages can¹t be published from the
MqttCallback (despite what the Javadoc says, which makes this even more
confusing).

Thanks!
Benjamin


Le 11/03/2014 13:28, « Julien Vermillard » <jvermillar@xxxxxxxxxxxxxxxxxx>
a écrit :

>Hi!
>With the java paho client, publishing a message inside the
>"messageArrived" callback is
>blocking the whole MQTT client.
>
>It's supposed to be like that? It's not that complex to delegate the
>publishing to another thread but I'm wondering if I missed something
>here.
>
>Thanks,
>Julien
>_______________________________________________
>paho-dev mailing list
>paho-dev@xxxxxxxxxxx
>
https://dev.eclipse.org/mailman/listinfo/paho-dev
>


_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/paho-dev



Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU


_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/paho-dev

-- 
Ian Craggs                          
icraggs@xxxxxxxxxx                 IBM United Kingdom
Comitter on Paho, Mosquitto


Back to the top