0
votes

I am using AWS IoT and have created a rule, which forwards the data received on this specific topic to a SQS queue.

The SQL statement for this rule is as below -

SELECT *, topic() AS topic FROM '+/topicname'

When a message is published to this queue, a lambda function is triggered. This lambda function processes the payload.

When I use the above rule, the lambda is getting triggered correctly.

I am parsing the sqsEvent.Records[0].Body to extract the payload and the topic name.

When I am using this rule, I am able to extract the topic name. But the complete JSON payload is not received. Only a partial payload is received in the lambda function.

The size of the JSON payload is around 700 bytes.

I think the maximum size of the message for a SQS queue is around 256 kb.

So I am not sure why the payload is getting trimmed.

Is there any issue with the SQL statement in the IoT rule?

If I use the below SQL statement, I am getting the complete payload, but I am not able to extract the topic name.

SELECT * FROM '+/topicname'

Is there any other way to extract the topic name?

1
Can you give an example of the "partial" payload received, and the corresponding untrimmed payload you expected?Michael - sqlbot

1 Answers

1
votes

Change the SQL version of you rule to "2016-03-23". I had the same issue with the trimmed messages, but with the latest SQL version it works like documented.