Description
In rumqttc, when calling AsyncClient::publish(), there is no way to retrieve the MQTT packet identifier (packet_id) assigned to the message. This makes it difficult to implement reliable message tracking and retransmission logic for concurrent publishes, since packet_id is only available later through Event::Outgoing(Outgoing::Publish(publish)).
Steps to Reproduce
-
Create an AsyncClient.
-
Call client.publish(topic, qos, retain, payload).await.
-
There is no return value for packet_id.
Expected Behavior
I would expect publish() to either:
-
Return the assigned packet_id immediately, or
-
Provide a mechanism to attach user-defined correlation data that can be reliably retrieved with the packet_id in Outgoing::Publish.
This would allow safely implementing concurrent publishes and retransmission logic without relying on a FIFO matching queue.
Actual Behavior
Use Case
-
Providing a Future handle upon publish, allowing retrieval of the packet_id used for this send, which would greatly facilitate message retransmission management.
-
Supporting fully concurrent publishing while maintaining correct mapping between messages and packet_id.
Suggested Solution
-
Either return the assigned packet_id from publish(), or
-
Provide a built-in way to attach a correlation ID to a publish message that is guaranteed to appear with its packet_id in Event::Outgoing.
Environment
rumqttc version: [0.25.0]
Description
In rumqttc, when calling AsyncClient::publish(), there is no way to retrieve the MQTT packet identifier (packet_id) assigned to the message. This makes it difficult to implement reliable message tracking and retransmission logic for concurrent publishes, since packet_id is only available later through Event::Outgoing(Outgoing::Publish(publish)).
Steps to Reproduce
Create an AsyncClient.
Call client.publish(topic, qos, retain, payload).await.
There is no return value for packet_id.
Expected Behavior
I would expect publish() to either:
Return the assigned packet_id immediately, or
Provide a mechanism to attach user-defined correlation data that can be reliably retrieved with the packet_id in Outgoing::Publish.
This would allow safely implementing concurrent publishes and retransmission logic without relying on a FIFO matching queue.
Actual Behavior
publish() returns ()
Packet_id is only visible asynchronously via Event::Outgoing, requiring a pending queue or FIFO matching that blocks true concurrency.
Use Case
Providing a Future handle upon publish, allowing retrieval of the packet_id used for this send, which would greatly facilitate message retransmission management.
Supporting fully concurrent publishing while maintaining correct mapping between messages and packet_id.
Suggested Solution
Either return the assigned packet_id from publish(), or
Provide a built-in way to attach a correlation ID to a publish message that is guaranteed to appear with its packet_id in Event::Outgoing.
Environment
rumqttc version: [0.25.0]