-
Notifications
You must be signed in to change notification settings - Fork 537
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
Support for AutoAckOff #578
Conversation
Signed-off-by: shivam <[email protected]>
Thanks for the PR - before I review it can you please sign the ECA (please let me know if you have any issues). Unfortunately I cannot accept a PR without a signed ECA (the aim being to ensure that all contributions are appropriately licensed). |
Done! |
Thanks very much for the PR. I have taken a quick look today and list a few concerns below; please note that these may seem fussy but I think its important that we get this right (once live it is very difficult to change the API and I want to minimise future issues caused by users not understanding how this all works). It's probably possible to address these concerns by documenting the My concerns are:
Adding this feature is likely to result in longer running handlers so I feel that its important to note:
Given these concerns I did consider whether we are going about this in the right way; alternatives would include:
Note: I'll copy this to the issue because it would be good to get feedback from users on this. |
Hi @MattBrittan and @shivamkm07, thanks for the PR! I've been running into a similar issue, and stumbled over the auto-ack. Coming from other message passing platforms, like Kafka and PubSub, I was very surprised that auto-ack'ing is even a thing (afaicr it's not even an option for Google's official PubSub library), especially since the Message.Ack() is essentially pointless because of that (at least to the end user of the library). My preferred option would be to have a ClientOption to at least turn it off (but ideally, not even auto-ack to begin with, but I understand this will create compatibility issues). I'm happy to give a PR for this a go if you two are busy. One crucial piece that MQTT brokers might be missing to make this really useful is some kind of backoff feature to delay re-delivering messages longer and longer if writes fail (so that we aren't spamming all of our server instances constantly with the same message upon failure), but that's beyond the scope of the client library I think. |
This reverts commit e28a1db.
Signed-off-by: shivam <[email protected]>
Hi @MattBrittan and @Volcore, Thanks for reviewing the PR. I agree adding |
Signed-off-by: shivam <[email protected]>
Signed-off-by: shivam <[email protected]>
Thanks very much for implementing this (sorry it took a few attempts!). |
@MattBrittan Is there any expected timeline at which the next patch release is scheduled? That would be better than using the latest master commit. |
Done - I had been holding off because of the major changes to status handling but as they have been in @master for a couple of months without any issues being raised I felt it was worth making a release. |
Thanks @MattBrittan!!! |
This MR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [github.com/eclipse/paho.mqtt.golang](https://github.com/eclipse/paho.mqtt.golang) | require | patch | `v1.4.1` -> `v1.4.3` | --- ### Release Notes <details> <summary>eclipse/paho.mqtt.golang (github.com/eclipse/paho.mqtt.golang)</summary> ### [`v1.4.3`](https://github.com/eclipse/paho.mqtt.golang/releases/tag/v1.4.3) [Compare Source](eclipse-paho/paho.mqtt.golang@v1.4.2...v1.4.3) Release 1.4.3 is a relatively small release to bring in changes made in the eight months since 1.4.2. Thanks to everyone who submitted issues and contributed code (list of the main merged pull requests below): #### What's Changed - Avoid Panic when keepalive is 1 by [@​tomatod](https://github.com/tomatod) in [#​622](eclipse-paho/paho.mqtt.golang#622) - Allow MQTT username/password in websocket URI [@​MattBrittan](https://github.com/MattBrittan) in [#​624](eclipse-paho/paho.mqtt.golang#624) - Add backoff when reconnecting following immediate connection loss [@​tomatod](https://github.com/tomatod) in [#​625](eclipse-paho/paho.mqtt.golang#625) - Update dependencies (github.com/gorilla/[email protected], golang.org/x/net, golang.org/x/sync) and specify `go 1.18` in `go.mod`. **Full Changelog**: eclipse-paho/paho.mqtt.golang@v1.4.2...v1.4.3 ### [`v1.4.2`](https://github.com/eclipse/paho.mqtt.golang/releases/tag/v1.4.2) [Compare Source](eclipse-paho/paho.mqtt.golang@v1.4.1...v1.4.2) Release 1.4.2 is relatively small and is mostly focused on tidying up the way the library manages the connection status. Previously `sync/ atomic` was used to read/update the status but this led to a range of potential deadlocks, and workarounds to avoid these, which made the code difficult to follow. The new [connectionStatus](https://github.com/eclipse/paho.mqtt.golang/blob/master/status.go#L113) separates status handling from `client` and should simplify further development whilst resolving potential race conditions. It is my hope that users will not notice any change ([@​master](https://github.com/master) was updated on 10th August and the updated code has been running in production at a few sites since then without issue). A further change is that it is now possible to disable auto acknowledgment so that received messages can be manually acknowledged (or, more to the point, not acknowledged!). Thanks to everyone who submitted issues and contributed code (list of the main merged pull requests below): #### What's Changed - Tidy up use of mutex in `messageIds` by [@​MattBrittan](https://github.com/MattBrittan) in [#​602](eclipse-paho/paho.mqtt.golang#602) - Resolve situation where broker accepted connection but did not respond to CONNECT packet in a timely manner (should be very unusual but was reported in [#​597](eclipse-paho/paho.mqtt.golang#597)). [@​MattBrittan](https://github.com/MattBrittan) in [#​603](eclipse-paho/paho.mqtt.golang#603) - Resolve race condition in test by [@​MattBrittan](https://github.com/MattBrittan) in [#​606](eclipse-paho/paho.mqtt.golang#606) - Re-architect status handling by [@​MattBrittan](https://github.com/MattBrittan) in [#​607](eclipse-paho/paho.mqtt.golang#607) - Enable manual ACK by [@​shivamkm07](https://github.com/shivamkm07) in [#​578](eclipse-paho/paho.mqtt.golang#578) #### New Contributors - [@​shivamkm07](https://github.com/shivamkm07) made their first contribution in [#​578](eclipse-paho/paho.mqtt.golang#578) **Full Changelog**: eclipse-paho/paho.mqtt.golang@v1.4.1...v1.4.2 </details> --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yODYuMSIsInVwZGF0ZWRJblZlciI6IjM3LjI4Ni4xIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIiwibGFiZWxzIjpbXX0=--> See merge request alpine/infra/build-server-status!8
This is to support disabling of Automatic Acking of messages by mqtt client. A similar solution has been merged in V5 client(eclipse-paho/paho.golang@a47276e). While V5 solution also takes care of Acks being sent in order, this doesn't seem a necessity as discussed here.
Issue Resolved: #459