Skip to content

Add Atomic Publish Support#962

Merged
mtmk merged 2 commits into
mainfrom
2.12/atomic-publish
Sep 26, 2025
Merged

Add Atomic Publish Support#962
mtmk merged 2 commits into
mainfrom
2.12/atomic-publish

Conversation

@mtmk

@mtmk mtmk commented Sep 25, 2025

Copy link
Copy Markdown
Member

This pull request adds support for the new AllowAtomicPublish property in the JetStream stream configuration as described in ADR-50, allowing atomic batch publishing into streams. It also includes comprehensive tests to verify the correct behavior of this property when creating, updating, and retrieving streams.

JetStream Stream Configuration Enhancements:

  • Added the AllowAtomicPublish property to the StreamConfig class, enabling atomic batch publishing for streams. This property is serialized to JSON as allow_atomic and is ignored when set to its default value.

Testing Improvements:

  • Introduced a new test, AllowAtomicPublish_property_should_be_set_on_stream, in ManageStreamTest.cs to verify that the AllowAtomicPublish property is correctly set, updated, and persisted on streams. The test is conditionally skipped for NATS server versions earlier than 2.12.
  • Added a missing using directive for NATS.Client.TestUtilities in the test file to support the new test.

@mtmk
mtmk requested review from Copilot and scottf September 25, 2025 10:20
@mtmk mtmk self-assigned this Sep 25, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request implements the new AllowAtomicPublish property for NATS JetStream streams as specified in ADR-50, enabling atomic batch publishing functionality. The changes add the necessary property to the StreamConfig model and include comprehensive testing to verify the feature works correctly.

Key changes:

  • Added the AllowAtomicPublish boolean property to StreamConfig with proper JSON serialization
  • Implemented comprehensive tests covering stream creation, retrieval, and updates with the new property
  • Added conditional test skipping for NATS server versions prior to 2.12 where this feature is not available

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/NATS.Client.JetStream/Models/StreamConfig.cs Added AllowAtomicPublish property with JSON serialization attributes
tests/NATS.Client.JetStream.Tests/ManageStreamTest.cs Added comprehensive test coverage and missing using directive

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

# Conflicts:
#	src/NATS.Client.JetStream/Models/StreamConfig.cs

@scottf scottf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@mtmk
mtmk merged commit 0a0ff84 into main Sep 26, 2025
21 checks passed
@mtmk
mtmk deleted the 2.12/atomic-publish branch September 26, 2025 09:39
mtmk added a commit that referenced this pull request Oct 1, 2025
* Add Prioritized Priority Consumer Policy (#965)
* Add persist mode support (#964)
* Add support for message schedules (#963)
* Add Atomic Publish Support (#962)
* Counter support for server v2.12 (#960)
@mtmk mtmk mentioned this pull request Oct 1, 2025
mtmk added a commit that referenced this pull request Oct 1, 2025
* Add Prioritized Priority Consumer Policy (#965)
* Add persist mode support (#964)
* Add support for message schedules (#963)
* Add Atomic Publish Support (#962)
* Counter support for server v2.12 (#960)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants