Skip to content

Conversation

piotrpio
Copy link
Collaborator

@piotrpio piotrpio commented Aug 26, 2025

Signed-off-by: Piotr Piotrowski piotr@synadia.com

Add a new NamePrefix field to OrderedConsumerConfig that allows users
to specify custom prefixes for ordered consumer names. When provided,
consumer names will be generated as {NamePrefix}_{sequence_number}
(e.g., "myapp_1", "myapp_2"). If not provided, the default behavior
of using a NUID as prefix is maintained.

Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
@piotrpio piotrpio marked this pull request as ready for review August 26, 2025 13:08
@piotrpio piotrpio requested review from Jarema and Copilot August 26, 2025 13:08
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for custom name prefixes for ordered consumers in the JetStream client. The change allows users to specify a custom prefix instead of relying on auto-generated NUID prefixes for ordered consumer names.

  • Added NamePrefix field to OrderedConsumerConfig with proper documentation
  • Updated both jetStream.OrderedConsumer and stream.OrderedConsumer methods to use custom prefix when provided
  • Added comprehensive test coverage for custom prefix functionality and sequence incrementation

Reviewed Changes

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

File Description
jetstream/consumer_config.go Added NamePrefix field to OrderedConsumerConfig with documentation
jetstream/jetstream.go Updated OrderedConsumer method to use custom prefix when provided
jetstream/stream.go Updated OrderedConsumer method to use custom prefix when provided
jetstream/test/ordered_test.go Added comprehensive tests for custom prefix functionality
Comments suppressed due to low confidence (1)

jetstream/test/ordered_test.go:225

  • [nitpick] The variable customPrefix is duplicated across test cases. Consider extracting it as a constant at the test function level to improve maintainability and reduce duplication.
			t.Fatalf("Unexpected error: %v", err)

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

@coveralls
Copy link

Coverage Status

coverage: 85.101% (+0.1%) from 84.955%
when pulling e9e5a0e on ordered-consumer-prefix
into 3d824b0 on main.

Copy link
Member

@aricart aricart left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@Jarema Jarema left a comment

Choose a reason for hiding this comment

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

LGTM!

@piotrpio piotrpio merged commit c857ae9 into main Sep 22, 2025
7 checks passed
@piotrpio piotrpio deleted the ordered-consumer-prefix branch September 22, 2025 15:00
@piotrpio piotrpio mentioned this pull request Sep 22, 2025
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.

4 participants