我有一个与蚊子经纪人的树莓和桥梁与亚马逊物联网服务。 https://aws.amazon.com/es/blogs/iot/how-to-bridge-mosquitto-mqtt-broker-to-aws-iot/重复的消息蚊子MQTT经纪人到亚马逊物联网服务使用持久性
这是我mosquitto.conf文件:
# Place your local configuration in /etc/mosquitto/conf.d/
#
# A full description of the configuration file is at
# /usr/share/doc/mosquitto/examples/mosquitto.conf.example
pid_file /var/run/mosquitto.pid
persistence true
persistence_location /var/lib/mosquitto/
log_dest file /var/log/mosquitto/mosquitto.log
include_dir /etc/mosquitto/conf.d
这是是/etc/mosquitto/conf.d
# =================================================================
# Bridges to AWS IOT
# =================================================================
# AWS IoT endpoint, use AWS CLI 'aws iot describe-endpoint'
connection awsiot
address xxxxxxxxx.iot.eu-central-1.amazonaws.com:8883
# Specifying which topics are bridged
topic awsiot_to_localgateway in 1
topic localgateway_to_awsiot/iot out 1
topic both_directions both 1
# Setting protocol version explicitly
bridge_protocol_version mqttv311
bridge_insecure false
# Bridge connection name and MQTT client Id,
# enabling the connection automatically when the broker starts.
cleansession true
clientid bridgeawsiot
start_type automatic
notifications false
log_type all
# =================================================================
# Certificate based SSL/TLS support
# -----------------------------------------------------------------
#Path to the rootCA
bridge_cafile /etc/mosquitto/certs/rootCA.pem
# Path to the PEM encoded client certificate
bridge_certfile /etc/mosquitto/certs/cert.crt
# Path to the PEM encoded client private key
bridge_keyfile /etc/mosquitto/certs/private.key
所有工作正常,内bridge.conf。但是,如果我取下以太网电缆来测试节拍。当通讯重新建立时。代理向亚马逊IoT服务发送重复消息。
这是我送
char dataToSend[] = "Message Id: ";
counter++;
snprintf(dataToSend, sizeof(dataToSend) + 10, "Message Id: %d", counter);
app_mqtt_publish(&dataToSend);
它是一个正常的行为的消息?
您尚未在该配置中包含该桥的详细信息。你还发送什么类型的消息,QOS和他们保留什么? – hardillb
对不起@hardillb ...编辑的问题。 QOS是1。 – JosepB