Skip to content
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

rumqttc - Get packet id for publish #349

Open
shikoku1 opened this issue Feb 11, 2022 · 15 comments
Open

rumqttc - Get packet id for publish #349

shikoku1 opened this issue Feb 11, 2022 · 15 comments
Labels
in-pipeline Planned to be resolved in a future release

Comments

@shikoku1
Copy link

There doesn't seem to be a way to get the packet id for a published QoS1/2 message, to track its state
Is this correct? Is there a workaround?

@shikoku1 shikoku1 changed the title Get packet id for publish rumqttc - Get packet id for publish Feb 11, 2022
@tekjar
Copy link
Contributor

tekjar commented Feb 15, 2022

@shikoku1 In release R12 (tentative release in 2 weeks), publish method will return packet id on success

@mladedav
Copy link
Contributor

mladedav commented Apr 4, 2022

@tekjar @de-sh does in-pipeline mean that there is a PR for this already? I couldn't find anything so I assume this was not released in March, correct?

I have looked around a bit and without changing the structure of client <-> envetloop architecture (where the latter is responsible for choosing packet IDs) I don't think there are other options than #291.

@tekjar
Copy link
Contributor

tekjar commented Apr 4, 2022

in-pipeline means we've planned to work on this. This being worked in mqtt v5 PR where we use locks to access eventloop buffers. This allows us to return packet ids in client

@mladedav
Copy link
Contributor

mladedav commented Apr 4, 2022

Is it planned also for 3.1.1? I've noticed that the v5 PR explicitly states that it doesn't make changes to lower versions.

I cannot migrate to 5 because of a broker but I would like to know that a message was delivered.

@tekjar
Copy link
Contributor

tekjar commented Apr 4, 2022

Yeah also planned in 3.1.1. It's just that all the feedback we've collected is going into v5 first

@mladedav
Copy link
Contributor

mladedav commented Apr 4, 2022

Ok, thanks for the clarifications.

@mladedav
Copy link
Contributor

Hi @tekjar . I have noticed that R13 was released with the MQTT5 support, but the publish method still returns Result<(), _>.

Was this pushed further back? This is still planned for 3.1.1, right?

@tekjar
Copy link
Contributor

tekjar commented Jun 28, 2022

Yeah this is planned @mladedav . Publish will return pkid. We still need to work on APIs

@svet-b
Copy link

svet-b commented Oct 15, 2022

Would very much love to see this implemented also. I noticed that in a few previous versions this was available for the v5 client, but was reverted more recently (due to other architectural changes).

Are there any workarounds in the meantime? Calling publish() and then inspecting the ID of the Publish event that's emitted on the loop? (seems brittle, of course, but maybe better than nothing)

@harlem88
Copy link

Is there any news about Publish will return pkid on v3.1.1?

@dlips
Copy link

dlips commented Feb 22, 2024

Hi, I would also need this functionality. Is there any progress on this topic?

@swanandx
Copy link
Member

Hi, I would also need this functionality. Is there any progress on this topic?

Hey @dlips , there was some progress, I created a PoC main...pkid-poc for an approach where we move pkid generation logic in client instead of state, thus allowing us to return pkid. 🚀

but as this lead to use to locks and shared states, this might slow down publishes during contention. The PoC hasn't been thoroughly reviewed yet, as other work was prioritized and lack of maintainers time 😅

other approach could be, instead of returning actual pkid, we can return some token which can be used for tracking packet. But ig it will more or less be same as our client can be cloned and shared between threads?

btw, can you let us know specific use case why you might need this functionality? we might try to figure out some workaround.

thank you :)

@dlips
Copy link

dlips commented Feb 22, 2024

I have to send messages to a broker in a reliable way. To this end, I implemented a persistent message queue with rusqlite. Then I send the messages to a MQTT broker with QOS 1 and would like to remove the messages from the queue/db if I get the ACK for them.

@cartertinney
Copy link

I also need this. I need the ability to track when an ack for a specific publish is received.

@leoedin
Copy link

leoedin commented Apr 18, 2024

We can't see a way to implement functional QoS 1 or QoS 2 without being able to match sent packets with the received PubAck ID. This would give us one way of doing that.

If there's complications with locks, could you instead allow the user to pass in something when calling .publish() which is then passed to the event loop via the Event::Outgoing::Publish enum? The event loop handler would then have both the user token and pkid. I think that change can be implemented with fairly minimal code changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in-pipeline Planned to be resolved in a future release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants