Replies: 5 comments 8 replies
-
The |
Beta Was this translation helpful? Give feedback.
-
Thank you for your support, @xiazhvera. I modified my test code so that I now have:
This is now the output. I removed the Internet connection after packet 11:
So, it appears to me that the |
Beta Was this translation helpful? Give feedback.
-
@xiazhvera, should I file a bug report for this? |
Beta Was this translation helpful? Give feedback.
-
In your latest example, you're using QoS 0. QoS 0 publish complete happens on socket write which is why you continue to get "successes" after severing the connectivity. In general, use QoS 0 when it's not critical that a message get delivered -- transient state data, for example. Going back to a QoS 1 approach, if you're going to resubmit a failed publish later, could you let it sit in the client's queue until connectivity is re-established? You cant directly manipulate the queue, but you can query some basic properties (# of messages, approximate total bytes used) to guide decision-making. The 5 client gives you a little more control over the queue by letting you establish a keep/reject policy:
There is no reliable way for the client to detect a disconnect outside of a full keep alive timeout, which for IoT Core is going to be ~45 seconds given a keep alive minimum of 30 seconds. Tcp keep alive might give you better results. It sounds like you want an end-to-end timeout for publishes that, if reached, will fail the operation no matter what state it is in. We don't presently support that, but it might be a good potential feature. Such a feature would need to coexist nicely with the fact that certain MQTT operations must be retried on reconnect (any unacked QoS 1 publishes that have been written to the wire) by specification. So even if we did add such a feature there will still be QoS 1 publishes which cannot be failed by the end-to-end timeout. In retrospect, the existing operation_timeout should have been "ack_timeout" leaving "timeout" available for a potential end-to-end feature. |
Beta Was this translation helpful? Give feedback.
-
The unfortunate answer to the feature-request questions is that, at least right now, it's very unlikely in the short term. The team has planned work that reaches well into next year. Priorities change and we regularly shuffle things to react, but it wouldn't be a good idea to wait on the availability/expectation of such a feature. I would advise against trying to re-create some kind of custom ack solution. Given what you've outlined so far, it seems like the following would work:
|
Beta Was this translation helpful? Give feedback.
-
Hello. The documentation states that
Aws::Crt::Mqtt::MqttConnection::Publish
will return:I have the following test code:
Code
If I start it when the system does not have an Internet connection, I get the expected output:
If I start it when the system does have an Internet connection, I still get the expected output:
However, if I remove the Internet connection while that is running,
Publish
continues to return the packet ID as if the publish was successful, which it of course was not.Whether by using the return value of
Publish
or another method, how can I tell if the Publish was actually successful?Thank you!
Beta Was this translation helpful? Give feedback.
All reactions