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

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

Back to the top