Duplicate MQTT messages being received at DynamoDB

0

So I have some sensors that are sending MQTT data using the IOT Core to DynamoDB. However I note that there are always 2 messages(duplicates). I am using Select for the topic, set up a Rule as was needed,etc. ITs all working fine, except for the duplicates. I looked through the questions but didn't find an answer. Any suggestion to find the root cause appreciated. Regards

6/11/22 additional data Some additional info might be useful so I have provided it here.

Rule query statement The source of the messages you want to process with this rule.

Extract below.............

SELECT state.reported.value as state_reported_value FROM '#' Using SQL version 2016-03-23 Actions Actions are what happens when a rule is triggered.

Insert a message into a DynamoDB table

Extract end.................

Hope this helps in directing me. Regards

2개 답변
0
수락된 답변

Hi fixingthingsguy. The issue is likely related to using a wildcard for the topic in the FROM statement of the rule. The state.reported.value property could be found in the message of more than one topic. Even amongst shadow topics and shadow documents.

In this case, it will likely appear in the shadow document for both the /update topic when the device publishes the new value and in the shadow document of the /updated/accepted topic when IoT Core responds. You probably want to change the FROM statement to use $aws/things/+/shadow/update if you're using the Classic shadow or $aws/things/+/shadow/name/<shadowName>/update if you're using a named shadow.

profile pictureAWS
전문가
Greg_B
답변함 2년 전
0

Greg_B. Thanks very much. I've been wracking my brains on this one. I just tested using your suggestion and the duplicates are not occurring. So for any future user who sees the same problem, here's the before and after SELECT using Classic Shadow. BEFORE: SELECT state.reported.value as state_reported_value FROM '#' AFTER Greg_B's suggestion: SELECT state.reported.value as state_reported_value FROM '$aws/things/+/shadow/update'

답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠