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

Ability to publish to a kv style topic only if empty #2494

Closed
ripienaar opened this issue Sep 7, 2021 · 3 comments · Fixed by #2506
Closed

Ability to publish to a kv style topic only if empty #2494

ripienaar opened this issue Sep 7, 2021 · 3 comments · Fixed by #2506
Assignees

Comments

@ripienaar
Copy link
Contributor

Feature Request

Use Case:

Today we have Nats-Expected-Last-Subject-Sequence that limits publishing to a stream if the previous message had a specific sequence

Along the same lines it would be useful to ensure only the first client can write a message when the subject is empty.

We discussed maybe (ab)using Nats-Expected-Last-Subject-Sequence:0 but decided not to, so maybe Nats-Expected-Empty-Subject:1

A sample use case could be for example registering a schema that relates to a specific topic, the first publisher to this topic should register the subject but that's true only ever once.

This setting should probably only be accepted in max_msgs_per_subject > 0 stream

@ripienaar ripienaar changed the title Ability to publish to a kv style topic if empty Ability to publish to a kv style topic only f empty Sep 7, 2021
@ripienaar ripienaar changed the title Ability to publish to a kv style topic only f empty Ability to publish to a kv style topic only if empty Sep 7, 2021
@derekcollison
Copy link
Member

Thinking more about this I think the original suggestion should work.

Nats-Expected-Last-Subject-Sequence: 0

@ripienaar
Copy link
Contributor Author

It needs to mean a subject we have never seen or one that we have seen and purged out.

But yeah I think that’s quite a obvious way to do it

@derekcollison
Copy link
Member

Working on it now.

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 a pull request may close this issue.

3 participants