-
Notifications
You must be signed in to change notification settings - Fork 258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enqueued qos0 dispatch MQTT_EVENT_PUBLISHED (IDFGH-12511) #273
base: master
Are you sure you want to change the base?
Conversation
Hi @nebkat thanks for your contribution. Could you clarify your use case here? |
Hi @euripedesrocha! When you Qos1+ can be used to receive the explicit confirmation back but I do not need that level of guarantee, I just want to know when the message got sent (including for tracking # of messages successfully published in this session).
And lastly, I would like to experiment with semaphore synchronized publishing which would be easier if all messages triggered |
@nebkat thanks for clarification. |
These are technically two separate issues - with QoS 0 we might not care whether the broker actually successfully processes the message once it is received, but we may still want to know whether the client ever attempted to send the message in the first place (since we queued it for asynchronous sending and otherwise have no way of knowing). In other words: it is ok if my broker or network connection somehow lose the message, but it seems wasteful to have to depend on the broker to observe the behavior of the client (by upgrading to QoS 1/2). With this change I use For synchronization, I would like to be able to do: // in handler
case ESP_MQTT_PUBLISH:
xTaskNotifyGive(task_handle);
// in task
esp_mqtt_client_enqueue(...); // QoS0
// Possibly do something here
if (!ulTaskNotifyTake(true, pdMS_TO_TICKS(1000))) return; // Stop publishing batch if previous message fails
esp_mqtt_client_enqueue(...); // QoS0
// Possibly do something here
if (!ulTaskNotifyTake(true, pdMS_TO_TICKS(1000))) return; // Stop publishing batch if previous message fails This is not possible with |
b437eb2
to
ec7b69e
Compare
ec7b69e
to
1cc5813
Compare
Dispatch
MQTT_EVENT_PUBLISHED
when an enqueued QOS0 message is actually published.