Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] Paho Java Client Exceptions

Dave,

Mike is correct.  We do intend to add this function to the IBM written clients (Java, C, _javascript_), but no firm plans as to when, yet.

Different people have different views on what function is essential.  For instance, for many people in IBM, having disk persistence in the client libraries is considered essential (the Java and desktop C clients do).  We avoided buffering messages when not connected because of the questions arising about what to do if lots of messages were stored on disk, how to manage them, and to let the application know if they were going to unintentionally delete unsent messages, and so on.

I'm not saying any particular view is correct, just that different people have different expectations. 

The bug for this function is:

440736: Allow applications to call publish when not connected
https://bugs.eclipse.org/bugs/show_bug.cgi?id=440736

Ian

On 07/14/2015 01:31 PM, Mike Tran wrote:
Hi Dave,

By design, if the Java client is not connected and the application attempts to publish or subscribe, MqttException is thrown with reason code = REASON_CODE_CLIENT_NOT_CONNECTED

https://www.eclipse.org/paho/files/javadoc/org/eclipse/paho/client/mqttv3/MqttException.html#REASON_CODE_CLIENT_NOT_CONNECTED

As for the retain flag, the MQTT specification states that the Server (not the client) must store the application message:
http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718038

--
Regards,
Mike Tran




From:        Dave Jensen <david@xxxxxxxxxxxx>
To:        paho-dev@xxxxxxxxxxx
Date:        07/14/2015 02:44 AM
Subject:        [paho-dev] Paho Java Client Exceptions
Sent by:        paho-dev-bounces@xxxxxxxxxxx




After using MQTT.js on the node.js platform I though it would be simple to use MQTT with Java, on Android, using the Paho Java client. I was wrong.

I've worked through most of my issues but there is one that bothers me. My understanding is that when you retain messages and publish, the client will figure out when to send. So if the connection is down, the developer of the client keeps publishing and when the connection is restored, the client goes ahead and publishes the messages. 

Using mqtt.js on node, I've testing this connection up, pub, received, connection down, pub, nothing, pub again, nothing, connection up, received both messages.

So when I tried a similar approach with the Paho Java client, I remove the connection, publish, and bam, I get an exception. Not only that, it also appears that the message is not retained in this code path. This forces the client user to self retain that message.

Is this intentional? A bug? Is there a different API that I should be using that I'm missing?

Any opinions, help, or criticisms would be greatly appreciated.

Thanks!
Dave_______________________________________________
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


_______________________________________________
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