fusesource/mqtt-client

Inner mqtt is not accessible in the CallbackConnection after it's created

sxam opened this issue · 0 comments

sxam commented

If I create a CallbackConnection using callbackConnection() method of MQTT class, it creates inner MQTT using "return new CallbackConnection(new MQTT(this))" . But the problem is that later on I don't have an access to it. And I need it in the following scenario:

I try to do connect that fails. If I see the "Could not connect: CONNECTION_REFUSED_NOT_AUTHORIZED" message, I don't want to connect anymore. So I tried to use mqtt.setConnectAttemptsMax(1); for it to affect the decision made by CallbackConnection in the onFailure method in tryReconnect checks ( "if(!CallbackConnection.this.disconnected && this.tryReconnect())" ) . But it seems that mqtt object I have at that point has got nothing to do with mqtt object CallbackConnection has, so it does nothing. As a bypass I currently try to play with "connection.suspend();
connection.kill" methods.