The discard policy should be set to "new", but really for server 2.7.2+ since only this server handles discard policy "new" correctly for KV use-case, that is with "max msgs per subject" set: this will prevent new "keys" to be added, but discard old for a given "key" allowing KV delete/purge (adding tombstone) to be added on a given "key" (subject).
The Go client has implemented a change that updates the stream's discard policy if connecting to a v2.7.2+ and find that the stream exists with discard policy "old": https://github.com/nats-io/nats.go/pull/917
The behavior is documented in ADR-8.
Clients and Tools
[x] Go @wallyqs
[x] Java @scottf
[x] JavaScript @aricart
[x] .Net @scottf
[x] C @kozlovic
[x] Python @wallyqs
[ ] Ruby @wallyqs
[x] Rust @Jarema
Other Tasks
[ ] docs.nats.io updated
[ ] Update ADR to Implemented
[ ] Update client features spreadsheet
Client authors please update with your progress. If you open issues in your own repositories as a result of this request, please link them to this one by pasting the issue URL in a comment or main issue description.
Overview
The discard policy should be set to "new", but really for server 2.7.2+ since only this server handles discard policy "new" correctly for KV use-case, that is with "max msgs per subject" set: this will prevent new "keys" to be added, but discard old for a given "key" allowing KV delete/purge (adding tombstone) to be added on a given "key" (subject).
The Go client has implemented a change that updates the stream's discard policy if connecting to a v2.7.2+ and find that the stream exists with discard policy "old": https://github.com/nats-io/nats.go/pull/917
The behavior is documented in ADR-8.
Clients and Tools
Other Tasks
Implemented
Client authors please update with your progress. If you open issues in your own repositories as a result of this request, please link them to this one by pasting the issue URL in a comment or main issue description.