How do I send a message with qos2 but with a confirmation timeout?
I am sending large messages, the memory for which is allocated dynamically, and if no callback is called after xx seconds, then I need to cancel the sending process. The description of the MQTTAgent_Publish command must follow the Note recommendation. The context passed to the callback through pCmdContext member of pCommandInfo parameter MUST remain in scope at least until the callback has been executed by the agent task.
After a timeout for publication, I release the allocated memory, the memory for the message, and as a result, the agent’s operation becomes incorrect.
xCommandAdded = MQTTAgent_Publish(&xGlobalMqttAgentContext,pmqtt_message,pxCommandParams );
....
awaiting notification from the callback
ack_result = xTaskNotifyWait(0,0,NULL,pdMS_TO_TICKS( mqttMS_TO_WAIT_FOR_NOTIFICATION ));
.....
i need to cancell publish command in this place
vPortFree()....