Flexy 205 Java: MQTT QoS 1 PUBACK & MQTT Connection state

Hi,

I’m working with Java and MQTT on Flexy 205 with firmware version 14.2s0.

Currently trying to deal with loss of MQTT connection in my code and potentially having a way to handle PUBACK messages received when using QoS 1, so I know to delete my buffered message if it was received by the broker.
I’ve found similar forum posts for BASIC here and here, but they don’t really help for Java.

I haven’t really found anything that I could use to indicate the connection state of my MQTT client, due to lack of documentation. I did find a snippet on the forum and this is all I have to detect a potential disconnect at the time:
public void callMqttEvent(int event) {
try {
// MQTT connection status change safeguard
if (event == 1) {
Utility.logWarning(“MQTT event occured - a disconnect might have happened.”);
Constants.connectionState = false;
return;
}

Any suggestions would be greatly appreciated!

  • Danilo

@djesic, I would recommend posting this on the Ewon Tech Fourm (https://techforum.ewon.biz) which has more of a focus on Java programming. Simon should be able to help you out.