Greengrass V2 deployment topics?

0

I am attempting to update a thing shadow when a deployment completes with the components & versions that are installed on the device. The way it's set up now is:

  1. An IoT rule that subscribes to SELECT * FROM '$aws/events/jobExecution/+/succeeded' and sends the message to a Lambda
  2. The Lambda takes the event, calls the listInstalledComponents api from the Greengrass sdk, then calls the updateThingShadow with the components.

However when the Lambda runs, the installed components that get updated in the shadow are not updated with the latest components. It's almost like the Lambda is run before the component listing is updated. I can see that the component listing in the AWS console updated as soon as the deployment is finished.

I'm wondering if there's a better topic to watch, or if there's some other way to do what I need. Any guidance would be appreciated.

asked 2 years ago217 views
1 Answer
0

Hi. I'm told that listInstalledComponents is eventually consistent. I think one way to deal with this might be to handle it similar to the recommended handling of disconnect lifecycle events. See Handling client disconnections here: https://docs.aws.amazon.com/iot/latest/developerguide/life-cycle-events.html

In short, insert an SQS delay queue between the event and the Lambda: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-delay-queues.html

profile pictureAWS
EXPERT
Greg_B
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions