question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AWSIoTTopic constant disconnected/reconnected messages

See original GitHub issue

Hi, I’m using the SDK on a Raspberry PI 3, Java 8 and having issues with listening on a Topic.

Basically, my code is:

public class TestTopicListener extends AWSIotTopic {

    public TestTopicListener(String topic, AWSIotQos qos) {
        super(topic, qos);
        System.out.println("Listener: Connecting to " + topic);
    }

    @Override
    public void onMessage(AWSIotMessage message) {
        System.out.println(System.currentTimeMillis() + ": <<< " + message.getStringPayload());
        if ( message.getStringPayload().equalsIgnoreCase("restart"))
                System.exit(0);
    }

}

And I’m just getting the following messages on the console: Jul 19, 2016 11:07:07 AM com.amazonaws.services.iot.client.core.AwsIotConnection onConnectionFailure INFO: Connection temporarily lost Jul 19, 2016 11:07:07 AM com.amazonaws.services.iot.client.core.AbstractAwsIotClient onConnectionFailure INFO: Client connection lost: rpi001 Jul 19, 2016 11:07:10 AM com.amazonaws.services.iot.client.core.AwsIotConnection$1 run INFO: Connection is being retried Jul 19, 2016 11:07:11 AM com.amazonaws.services.iot.client.core.AwsIotConnection onConnectionSuccess INFO: Connection successfully established Jul 19, 2016 11:07:11 AM com.amazonaws.services.iot.client.core.AbstractAwsIotClient onConnectionSuccess INFO: Client connection active: rpi001 Jul 19, 2016 11:07:12 AM com.amazonaws.services.iot.client.mqtt.AwsIotMqttMessageListener onFailure WARNING: Request failed for topic $aws/things/rpi001/shadow/update: Connection lost (32109) - java.io.EOFException Jul 19, 2016 11:07:12 AM com.amazonaws.services.iot.client.core.AwsIotConnection onConnectionFailure INFO: Connection temporarily lost Jul 19, 2016 11:07:12 AM com.amazonaws.services.iot.client.core.AbstractAwsIotClient onConnectionFailure INFO: Client connection lost: rpi001 Jul 19, 2016 11:07:15 AM com.amazonaws.services.iot.client.core.AwsIotConnection$1 run INFO: Connection is being retried Jul 19, 2016 11:07:15 AM com.amazonaws.services.iot.client.core.AwsIotConnection onConnectionSuccess INFO: Connection successfully established I’m subscribing to $aws/things/rpi001/shadow/update. It does seem like the very first message I publish on that topic from the client, the client also receives. But after that one, nothing…

The strange thing is that my publications to another topic seem to be working fine along with publishing to $aws/things/rpi001/shadow/update from the client. I’m seeing the updates in the IoT console.

Any help would be appreciated!

Thanks, Mac

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:16 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
rongsawscommented, Jul 20, 2016

There are two things to rule out first when it comes to connection issues. One is client side issues, such as intermittent network issues; another one is server side disconnect, which can be caused by various reasons, such as policy violation, protocol violations and so on. Can you check your CloudWatch logs for IoT to see if you see any errors there? Another check worth doing is to do a packet capture using tcpdump on your rPi and check how the TCP connection is terminated. If you could share your packet capture file, I’m happy to take a look at it.

0reactions
davidmco65commented, Jul 20, 2016

Hmmm, I thought it was seconds, that’s why I set 30. I’ve changed to 30000 now. Strange though how 30 ms was enough to stop it from bouncing back and forth.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AWS IoT Core Now Enables Customers to Store Messages for ...
Persistent Sessions store subscription information and pending Quality of Service (QoS) 1 messages should the devices become disconnected.
Read more >
AWSIotTopic - aws-iot-device-sdk-java 1.3.7 API
This class extends AWSIotMessage , therefore callback functions in AWSIotMessage can also be overridden if the application wishes to be invoked for the...
Read more >
The aws-iot-device-sdk-java's discuss from aws - Coder Social
AWSIoTTopic constant disconnected/reconnected messages. Hi, I'm using the SDK on a Raspberry PI 3, Java 8 and having issues with listening on a...
Read more >
Subscribe to AWS IoT topic on InfluxDB - DEV Community ‍ ‍
Hey , here is my first post after the community builder renewal . In this post, we would send some MQTT messages in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found