By using AWS re:Post, you agree to the Terms of Use

IoT Core Can Connect, Can Subscribe, Can Not Publish


I have a java app which can connect and subscribe to IoT Core but disconnects if I try to publish. This same app connects, subscribes and publishes to a stand alone broker running in the cloud but will not publish to IoT Core. Additionally using the same certificate and Id I can publish using the MQTT.fx client. I have seen multiple similar questions but haven't found any solutions. Hopefully someone can help?

Code is:

public void publish(String topic,String message) {
	    MqttMessage sPayload = new MqttMessage(message.getBytes());
	    try {	
	        sampleClient.publish(topic, sPayload);
		} catch (MqttException e) {

Error is:

Connection lost (32109) -
	at Source)
Caused by:
	at Source)
	at org.eclipse.paho.client.mqttv3.internal.wire.MqttInputStream.readMqttWireMessage(
	... 1 more

Policy is:

  "Version": "2012-10-17",
  "Statement": [
      "Effect": "Allow",
      "Action": "iot:*",
      "Resource": "*"
asked 4 years ago60 views
1 Answer

Well, turns out I'm a dummy who needs to RTFM.

AWS IoT does not support publishing and subscribing with QoS 2.
answered 4 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions