Skip to content

MQTT subscriber stops consuming messages after some inactivity time #246

Closed
@agupta0105

Description

@agupta0105

Describe the issue

I have been running a service which is based on this sdk. This service connects to MQTT broker using certs and AwsIotMqttConnectionBuilder to get the connection object. Lately I am observing that subscriber stops consuming messages from the broker even though there are messages getting published. It happens only when there is an inactivity time gap b/w messages.

I have checked the trace logs of sdk but could not find anything which can give details on this subscriber issue. Only way to solve this is to restart that connection/service.

Below are the details:
```

software.amazon.awssdk.iotdevicesdk
aws-iot-device-sdk
1.6.1


JDK : 1.8

### Steps to Reproduce

private final Runnable mqttConsumerTask = new Runnable() {
@OverRide
public void run() {
try {
connection.subscribe(Constants.TOPIC, QualityOfService.AT_MOST_ONCE, mqttConsumer);
} catch (Exception e) {
logger.error("Error while subscribing the topic {}", Constants.TOPIC_CMD_RESP);
}
}
};

private final Consumer<MqttMessage> mqttConsumer = new Consumer<MqttMessage>() {
	@Override
	public void accept(MqttMessage msg) {
		....
	}
};

private void startMsgReceiver() {
	asyncExecutors.execute(mqttConsumerTask);
	
}

Current behavior

No response

aws-iot-device-sdk-java-v2 version used

1.6.1

JDK version used

openjdk version "1.8.0_252" OpenJDK Runtime Environment (build 1.8.0_252-b09) OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)

Operating System and version

Ubuntu 5.4.0-1024-aws #24-Ubuntu SMP Sat Sep 5 06:19:55 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    guidanceQuestion that needs advice or information.needs-triageThis issue or PR still needs to be triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions