跳至內容

Creating a Remote Job does not trigger a NextNotification

0

Hello, I am developing a Greengrass component responsible for handling remote jobs following this guide. When the components starts it successfully retrieves a pending job using the get mqtt topic, however when I update its status to Succeded I don't receive a notification in the $aws/things/MyThing/jobs/notify-next topic even though I am correctly subscribed.

I tried subscribing using the Messaging test client on the Thing from the LocalDebugConsole component and the problem persists, however when the MQTT test client directly from the AWS dashboard the messages arrive correctly (both on the notify and notify-next topics)

已提問 1 年前檢視次數 188 次

2 個答案
0
已接受的答案

For future reference, looks like the policy should be attached directly to the thing instead of a thing group in order to receive notify-next updates.

已回答 1 年前

專家

已審閱 1 年前

0

When working with AWS IoT Jobs, there are specific conditions under which notifications are published to the jobs/notify and jobs/notify-next topics.

Based on your description, there are a few potential reasons why you're not receiving a notification on the $aws/things/MyThing/jobs/notify-next topic:

  1. The notify-next topic only receives a message when the status of the first job execution in the list changes. If you're updating a job to "Succeeded" but it wasn't the next job in the queue (or if there are no other jobs in the queue), you won't receive a notification on the notify-next topic.

  2. When a job completes (status changes to "Succeeded"), a notification is published to the jobs/notify topic, but a notification is only published to the jobs/notify-next topic if the next job in the queue has changed as a result.

  3. If the queue is empty after your job completes, a NextNotification should be published to the jobs/notify-next topic with an empty message.

Since you mentioned that you can see the messages when using the MQTT test client from the AWS dashboard but not from the LocalDebugConsole component, this suggests a potential issue with your Greengrass component's subscription or message handling:

  • Verify that your Greengrass component has the correct permissions to subscribe to these topics
  • Check that you're using QoS level 1 for your subscriptions
  • Ensure that your component is correctly processing the messages it receives

Also, note that response messages from the AWS IoT Jobs service don't pass through the message broker and can't be subscribed to by other clients or rules. To receive job activity-related messages, you need to use the notify and notify-next topics and ensure that jobs events are enabled.
Sources
Jobs notifications - AWS IoT Core
Jobs events - AWS IoT Core
AWS IoT Device Not Starting Remote Job | AWS re:Post

已回答 1 年前

專家

已審閱 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。