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
질문됨 일 년 전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
전문가
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠