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
質問済み 1年前232ビュー
1回答
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
エキスパート
回答済み 1年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ