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

Documenting Publishing.Expiration usage #232

Merged
merged 2 commits into from
Dec 5, 2023

Conversation

niksteff
Copy link
Contributor

So this one got me good on a really nasty bug from my side. I was using the pkg to publish big batches of messages to a queue. When reading the source code it was not clear to me the value was used as milliseconds. I assumed wrongly if the value is 0 the message will not expire. I assumed this because 0 would be the nil value for a go int. This assumption was painfully wrong - which lead to all messages not immediately retrieved by the consumer to get rightfully deleted. I wanted to spare others from the same mistake.

I am perfectly aware the rabbit mq documentation states the usage here: https://www.rabbitmq.com/ttl.html#per-message-ttl-in-publishers

But I think a little more documentation in the code and some clarification can prevent others from making the same mistake. I also provided two constants for the field that further elaborate on the usage and should explain it in its entirety. They are not needed but so are the DeliveryMode constants (Transient, Persistent). If this is not wanted please provide feedback and I will refine the PR.

Best regards and thank you all a lot for your work on this client!

- adds documentation that describes how the Expiration field should be used
- provides two constants for the most presumable pitfalls
@niksteff niksteff marked this pull request as ready for review November 29, 2023 10:03
@Zerpet Zerpet self-assigned this Dec 5, 2023
@Zerpet Zerpet self-requested a review December 5, 2023 11:31
@Zerpet Zerpet added this to the 1.9.1 milestone Dec 5, 2023
Copy link
Contributor

@Zerpet Zerpet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@Zerpet
Copy link
Contributor

Zerpet commented Dec 5, 2023

I will merge after CI passes since we have a restriction in place for merging 🔒

@Zerpet Zerpet merged commit 073b183 into rabbitmq:main Dec 5, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants