我有一個與蚊子經紀人的樹莓和橋樑與亞馬遜物聯網服務。 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