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.

demandé il y a 2 ans220 vues
1 réponse
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
répondu il y a 2 ans

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions