Skip to content

Conversation

@aricart
Copy link
Member

@aricart aricart commented Jul 1, 2025

Introduced the lastSubjectSequenceSubject option to enable subject-specific sequence constraints when publishing messages. Updated relevant headers, types, and tests to support this feature.

See nats-io/nats-server#5280

@aricart aricart requested a review from kozlovic July 1, 2025 16:57
Copy link
Member

@kozlovic kozlovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but comments are a bit weird.

const js = jsm.jetstream();

await Promise.all([
js.publish("a.1.foo", "1:1"), // Last is 1 for aa.1.foo; 1 for a.1.*;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo in comment aa.1.foo

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

await pc("a.1.bar", "a.1.*", 3, false);
await pc("a.1.bar", "a.1.*", 4, false);
await pc("a.1.bar", "a.1.*", 5, false);
await pc("a.1.bar", "a.1.*", 6, true); // Last is 8 for a.1.bar; 8 for a.1.*;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that you copied the comment from the Go client, but I think it is wrong. Last is 6 for a.1.bar. However, inserting that new message will make a.1.bar sequence 8, since the original publishes ended at 7.

Maybe that's what the comment means, but if anything, the comment should explain why "6" is the proper sequence for this subject.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes I c/p the ns test... Let me print the sequences that it onboards and update the comment with that

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed the comments/doc to be more useful

Introduced the `lastSubjectSequenceSubject` option to enable subject-specific sequence constraints when publishing messages. Updated relevant headers, types, and tests to support this feature.

See nats-io/nats-server#5280

Signed-off-by: Alberto Ricart <[email protected]>
Signed-off-by: Alberto Ricart <[email protected]>
@aricart aricart requested a review from kozlovic July 2, 2025 20:04
@aricart aricart merged commit 154fa70 into main Jul 2, 2025
24 checks passed
@aricart aricart deleted the fix-283 branch July 2, 2025 20:19
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 this pull request may close these issues.

3 participants