Hello All
I create a new MqttClientOption from a JsonObject
public static void main (String args[]) {
try {
MqttClientOptions options02 = new MqttClientOptions (new MqttClientOptions ().toJson()) ;
} catch (Exception ex) {
ex.printStackTrace();
}
}
Then I get an exception.
at io.vertx.mqtt.MqttClientOptions.setKeepAliveInterval(MqttClientOptions.java:316)
at io.vertx.mqtt.MqttClientOptions.setIdleTimeout(MqttClientOptions.java:472)
at io.vertx.mqtt.MqttClientOptions.setIdleTimeout(MqttClientOptions.java:33)
at io.vertx.core.net.TCPSSLOptionsConverter.fromJson(TCPSSLOptionsConverter.java:59)
at io.vertx.core.net.TCPSSLOptions.<init>(TCPSSLOptions.java:172)
at io.vertx.core.net.ClientOptionsBase.<init>(ClientOptionsBase.java:82)
at io.vertx.core.net.NetClientOptions.<init>(NetClientOptions.java:96)
at io.vertx.mqtt.MqttClientOptions.<init>(MqttClientOptions.java:94)
at io.ourexchanges.testCluster.TestMQClientConfig.main(TestMQClientConfig.java:42)
The issue comes with version 4.4.4 in the MqttClientOptions class in the method public MqttClientOptions setKeepAliveInterval(int keepAliveInterval) when it is called by the deprecated method public MqttClientOptions setIdleTimeout(int idleTimeout)
Which is called by the ancestor of MqttClientOptions.
The constructor new MqttClientOptions (JsonObject) invokes the method setKeepAliveInterval (int) with a value = 0.
This bug blocks me to create MQTT Client configuration from predefined Json configuration.
In my workaround, I check the value of the int parameter. If it is less than one, I replace it with MqttClientOptions.DEFAULT_KEEP_ALIVE_INTERVAL;
Hello All I create a new MqttClientOption from a JsonObject
Then I get an exception.
The issue comes with version 4.4.4 in the MqttClientOptions class in the method public MqttClientOptions setKeepAliveInterval(int keepAliveInterval) when it is called by the deprecated method public MqttClientOptions setIdleTimeout(int idleTimeout) Which is called by the ancestor of MqttClientOptions.
The constructor new MqttClientOptions (JsonObject) invokes the method setKeepAliveInterval (int) with a value = 0. This bug blocks me to create MQTT Client configuration from predefined Json configuration.
In my workaround, I check the value of the int parameter. If it is less than one, I replace it with MqttClientOptions.DEFAULT_KEEP_ALIVE_INTERVAL;
Question: Is there a reason for that behaviour or it is a bug?
Thank you for your answer Paul
Windows 10 with Java: 20.0.1; OpenJDK 64-Bit Server VM 20.0.1+9