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.

gefragt vor 2 Jahren219 Aufrufe
1 Antwort
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
EXPERTE
Greg_B
beantwortet vor 2 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen