-
Notifications
You must be signed in to change notification settings - Fork 231
Add per-message TTL support #763
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
Conversation
Signed-off-by: Casper Beyer <casper@synadia.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for per-message Time-To-Live (TTL) functionality, a feature introduced in NATS Server 2.11+. The implementation allows clients to specify a TTL for individual messages published to JetStream streams that have the allow_msg_ttl option enabled.
Key changes:
- Added
msg_ttlparameter topublish()andpublish_async()methods for setting per-message TTL in seconds - Added
allow_msg_ttlconfiguration option toStreamConfigfor enabling per-message TTL on streams - Added comprehensive test coverage verifying TTL behavior including message expiration and stream state updates
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| nats/src/nats/js/api.py | Added MSG_TTL header constant and allow_msg_ttl stream configuration field |
| nats/src/nats/js/client.py | Implemented msg_ttl parameter in publish methods with nanosecond conversion logic |
| nats/tests/test_js.py | Added comprehensive test validating TTL functionality with multiple expiration scenarios |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Signed-off-by: Casper Beyer <casper@synadia.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.