How can I retrieve the UUID of the inserted record?
Hey guys @IoT Cloud i have devices that collect few samples each week, storing the data indefinitely. Using AWS IoT, I’ve connected the devices to IoT Core and can publish/subscribe via MQTT. A rule forwards payloads to an HTTP endpoint, which inserts records into an RDS database and returns a UUID.
Previously, I sent JSON directly to the HTTP endpoint, received the UUID, and stored it with the sample on the device. However, with MQTT, I can’t receive the UUID back. The response only includes the original message. How can I retrieve the UUID of the inserted record? If this approach is incorrect, what alternative should I consider?
Solution:Jump to solution
To retrieve the UUID of the inserted record, consider these options:
1. Use AWS Lambda to process the message and return the UUID.
2. Implement a callback mechanism to store and retrieve UUIDs.
3. Use a correlation ID to match responses with original messages....
3 Replies
have your device publish the message to an MQTT topic. An IoT Rule forwards this message to a Lambda function, which inserts the record into RDS and generates a UUID. The Lambda function then publishes the UUID to a response MQTT topic, which the device subscribes to, enabling it to receive the UUID.
Solution
To retrieve the UUID of the inserted record, consider these options:
1. Use AWS Lambda to process the message and return the UUID.
2. Implement a callback mechanism to store and retrieve UUIDs.
3. Use a correlation ID to match responses with original messages.
@Daniel kalu this is valid