-1

I use IoT SDK in JAVA. When my application starts, it connects to IoT core of AWS:

iotClient = new AWSIotMqttClient(. . .);            
iotClient.connect();

But after application starting I see in my log a very strange behavior and it happens every 10 minutes:

[pool-8-thread-1] com.amazonaws.services.iot.client.core.AwsIotConnection.onConnectionSuccess Connection successfully established
[pool-8-thread-1] com.amazonaws.services.iot.client.core.AbstractAwsIotClient.onConnectionSuccess Client connection active: <client ID>
[pool-8-thread-1] com.amazonaws.services.iot.client.core.AwsIotConnection.onConnectionFailure Connection temporarily lost
[pool-8-thread-1] com.amazonaws.services.iot.client.core.AbstractAwsIotClient.onConnectionFailure Client connection lost: <client ID>
[pool-8-thread-1] com.amazonaws.services.iot.client.core.AwsIotConnection$1.run Connection is being retried
[pool-8-thread-1] com.amazonaws.services.iot.client.core.AwsIotConnection.onConnectionSuccess Connection successfully established
[pool-8-thread-1] com.amazonaws.services.iot.client.core.AbstractAwsIotClient.onConnectionSuccess Client connection active: <client ID>

How can I disable reconnection every 10 minutes? I use IoT Rules on CONNECTED/DISCONNECTED topic, so reconnection every 10 minutes fires this rule every 10 minutes...

Rougher
  • 834
  • 5
  • 19
  • 46

2 Answers2

1

Had the same issue, only on my EKS Kubernetes Cluster, but not on my local dev computer. I found out that the Default keepalive interval of the java lib is 600000ms or 10 minutes. This is not what some documentation declared.

The NAT used on my cluster has a fix Idle Timeout of 350 seconds. So the connection would drop.

I changed it to a lower value (like 30000ms).

iotClient.setKeepAliveInterval(30000);

For now this seems to work.

Bluco
  • 11
  • 1
0

I don't know why, but it is my solution:

iotClient = new AWSIotMqttClient(. . .);    
        
iotClient.setKeepAliveInterval(0);

iotClient.connect();
Rougher
  • 834
  • 5
  • 19
  • 46