Skip to content

Add limit_marker_ttl (SubjectDeleteMarkerTTL) for JetStream's per-key TTL / delete-marker support #725

@ilyaryabikin

Description

@ilyaryabikin

Proposed change

nats.py's nats.js.api.KeyValueConfig as long as nats.js.api.StreamConfig do not expose the JetStream's "limit marker" option required to enable per-key TTL with delete markers. While KeyValueConfig's ttl option sets the expiration for values, without limit_marker_ttl the client cannot receive PURGE events when keys expire.

As a workaround, it is currently possible to declare a kv externally, e.g. using the nats-cli: nats kv add mybucket --ttl=60s --marker-ttl=60s.

Proposed solution: add new field limit_marker_ttl to nats.js.api.KeyValueConfig, then add the same field to nats.js.api.StreamConfig and check if it's handled correctly in nats.js.manager.JetStreamManager.add_stream.

Context:

  • nats-py version: 2.11.0
  • nats-server version: 2.11.8

References:

Use case

I need to watch not only PUT events in a KV bucket, but also PURGE events when keys are automatically deleted according to the bucket's TTL policy. Without limit_marker_ttl, I cannot achieve feature parity with other SDKs and cannot reliably react to key expirations.

Contribution

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    proposalEnhancement idea or proposal

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions