You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a --keep-last-msg-per-subject flag to the nats server configuration i.e. nats stream add --keep-last-msg-per-subject <more-options> <stream> that works with all limits-based message retention policies (i.e time-based, size-based, count-based).
Use case
Stream limits options (e.g. max-age, max-bytes, max-msgs etc.) mostly seem to operate on a per stream basis. The exception is the max-msgs-per-subject which allows for a per subject based limit.
It would be nice to have the capability to always retain the last message on all given subjects in a stream while setting a time-based message retention policy i.e. delete all messages past an age of 10 mins except the last.
A use case of this can be as follows:
We want to record changes to a configuration (stored in a nats subject) and keep a history for a certain period of time e.g. 5 days (specified by the --max-age flag)
We always want to be able to fetch the last configuration to initialize our long-running application (which may run for weeks on end) whenever it restarts
Contribution
Yes, I can contribute to this feature
The text was updated successfully, but these errors were encountered:
Proposed change
Add a
--keep-last-msg-per-subject
flag to the nats server configuration i.e.nats stream add --keep-last-msg-per-subject <more-options> <stream>
that works with all limits-based message retention policies (i.e time-based, size-based, count-based).Use case
Stream limits options (e.g.
max-age
,max-bytes
,max-msgs
etc.) mostly seem to operate on a per stream basis. The exception is themax-msgs-per-subject
which allows for a per subject based limit.It would be nice to have the capability to always retain the last message on all given subjects in a stream while setting a time-based message retention policy i.e. delete all messages past an age of 10 mins except the last.
A use case of this can be as follows:
Contribution
Yes, I can contribute to this feature
The text was updated successfully, but these errors were encountered: