How can I control the time out of waiting for response to an update publish

0

I'm working with AFR and using Shadow and MQTT agent libs. I have two named shadows. I publish two update messages, one for each shadow, one after the other in a raw, and I see that the first shadow incoming publish update accepted message arrives after I send the second shadow update message and I get and error in prvIncomingPublishUpdateAcceptedCallback (That is based on the AFR demo shadow_device_task) saying that the ulClientToken is not the one the function is expected and thus it is ignored. I can see that the ignored ulClientToken is belong to the first update message and the comment in the function saying:

/* If we are waiting for a response, ulClientToken will be the token for the response
  * we are waiting for, else it will be 0. ulRecievedToken may not match if the response is
  * not for us or if it is is a response that arrived after we timed out
  * waiting for it.
*/

I guess my case is related to the last sentence in this comment and the response I got actually belong to the first update, so how I can control this time out that the comment is mention so I can enlarge it? Thanks

EyalG
gefragt vor einem Jahr233 Aufrufe
1 Antwort
0

Hi Eyal,

The problem is likely not a time out but the fact that the demo code is not designed to handle more than 1 in-flight update to shadow documents. The ulClientToken variable is global and can only store one value: if the second publish happens before the reception of the accepted/rejected messages for the first publish, its value gets overwritten. You could modify the sample to use a set/map/list to store all the pending client tokens and match them to the received client token in prvIncomingPublishUpdateAcceptedCallback.

Cheers,

Massimiliano

AWS
EXPERTE
beantwortet vor einem Jahr

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