Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to be notified when shadow is deleted? #12

Closed
iheb-eddine opened this issue Jan 13, 2016 · 2 comments
Closed

How to be notified when shadow is deleted? #12

iheb-eddine opened this issue Jan 13, 2016 · 2 comments

Comments

@iheb-eddine
Copy link

Hello,

I register to shadow attributes using this function aws_iot_shadow_register_delta.
Then I am doing a loop on aws_iot_shadow_yield and checking the return value of yield.

When the shadow is removed, I won't be notified and the yield does not return an error.
This is a serious problem for us, because in this case we should stop our service.

Is there a way to receive notification when shadow is removed?

Regards,
Iheb Eddine

@bhadrip
Copy link
Contributor

bhadrip commented Jan 14, 2016

Hello Iheb,

Anytime a shadow is deleted, a message is sent on the $aws/things/thingName/shadow/delete/accepted topic. If you can listen to this topic, then you will be notified anytime the shadow is deleted.

Unfortunately that is not part of our shadow API currently. We will add it to our future release.

Having said that, we can do it currently by directly subscribing to the topic.

The code will be something like this:

MQTTSubscribeParams subParams = MQTTSubscribeParamsDefault;
subParams.mHandler = MQTTcallbackHandler;
subParams.pTopic = "$aws/things/My-Custom-ThingName/shadow/delete/accepted";
subParams.qos = QOS_0;

INFO("Shadow Connect");
rc = aws_iot_shadow_connect(&mqttClient, &sp);
rc = mqttClient.subscribe(&subParams);

The MQTTcallbackHandler will be invoked anytime Shadow is deleted.

Hope this helps. Please let me know if you have more questions.

Thanks
Bhadri

@chaurah
Copy link
Contributor

chaurah commented Jun 27, 2016

Hi Iheb,
We have added a callback to the Shadow Connect Parameters which can be used for delete notifications. I am closing this issue now. Please feel free to let us know if there are any other issues we can help you with.

Rahul

@chaurah chaurah closed this as completed Jun 27, 2016
aggarw13 added a commit to aggarw13/aws-iot-device-sdk-embedded-C that referenced this issue Nov 29, 2019
…updates

Rename remaining occurrences of previous API names, and update API documentation of public-facing Foundry SDK functions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants