Skip to content

Rename Consumer Feature to Consumer SettleStrategy#82

Merged
Gsantomaggio merged 3 commits intomainfrom
change/consumer_feature
Feb 10, 2026
Merged

Rename Consumer Feature to Consumer SettleStrategy#82
Gsantomaggio merged 3 commits intomainfrom
change/consumer_feature

Conversation

@Gsantomaggio
Copy link
Copy Markdown
Member

Rename Consumer Feature to Consumer SettleStrategy names like the other clients

Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Copy link
Copy Markdown
Contributor

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

Renames the consumer “feature” configuration to a settle-strategy concept and aligns RPC requester configuration with the same naming used by other AMQP 1.0 clients.

Changes:

  • Replace ConsumerFeature/ConsumerOptions.Feature with ConsumerSettleStrategy/ConsumerOptions.SettleStrategy and rename DefaultSettle to ExplicitSettle.
  • Replace RequesterOptions.DirectReplyTo bool with RequesterOptions.SettleStrategy ConsumerSettleStrategy.
  • Update tests, examples, AGENTS guidance, and changelog to reflect the new API names.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
pkg/rabbitmqamqp/requester.go Replaces DirectReplyTo bool option with SettleStrategy in requester options documentation.
pkg/rabbitmqamqp/amqp_types.go Introduces ConsumerSettleStrategy and renames consumer option field to SettleStrategy.
pkg/rabbitmqamqp/amqp_exchange_test.go Updates test string referencing the renamed settle strategy constant.
pkg/rabbitmqamqp/amqp_consumer_test.go Updates tests to use SettleStrategy and renamed enum values.
pkg/rabbitmqamqp/amqp_connection.go Updates requester creation logic to use SettleStrategy instead of DirectReplyTo.
docs/examples/rpc_echo_server/main.go Updates RPC example to use SettleStrategy: DirectReplyTo.
docs/examples/pre_settled/pre_settled.go Updates pre-settled example to use SettleStrategy: PreSettled.
CHANGELOG.md Documents breaking API renames for consumers and requesters.
AGENTS.md Updates assistant guidance to reference settle strategy configuration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +79 to +83
// Use DirectReplyTo so replies are received via RabbitMQ direct-reply-to (no reply queue declared).
// See: https://www.rabbitmq.com/docs/direct-reply-to#overview
// That's the recommended way to receive replies for RPC clients,
// as it avoids the overhead of declaring and consuming from a reply queue.
SettleStrategy: rabbitmqamqp.DirectReplyTo,
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

This example hard-codes DirectReplyTo, but direct-reply-to is only supported on RabbitMQ 4.2+ (the client enforces this in consumer validation). It would help to mention the minimum RabbitMQ version (or show a fallback to ExplicitSettle) so users on 4.0/4.1 don't hit a confusing runtime error.

Copilot uses AI. Check for mistakes.
Comment thread AGENTS.md
Comment on lines +279 to 280
if options.SettleStrategy != DirectReplyTo {

Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

RequesterOptions.SettleStrategy is treated as a boolean toggle here: any value other than DirectReplyTo will declare a reply queue. Since ConsumerSettleStrategy also includes PreSettled (and could receive unknown values), this should validate and reject unsupported strategies (or explicitly handle them) to avoid silent misconfiguration.

Suggested change
if options.SettleStrategy != DirectReplyTo {
switch options.SettleStrategy {
case DirectReplyTo:
// No reply queue is declared when using DirectReplyTo.
case PreSettled:
// PreSettled is not a valid strategy for a requester that expects replies.
return nil, fmt.Errorf("unsupported settle strategy for requester: %v", options.SettleStrategy)
default:

Copilot uses AI. Check for mistakes.
Comment thread pkg/rabbitmqamqp/amqp_connection.go Outdated
Comment on lines +336 to +338
settleStrategy := ExplicitSettle
if options.SettleStrategy == DirectReplyTo {
settleStrategy = DirectReplyTo
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

This mapping coerces all non-DirectReplyTo strategies to ExplicitSettle, which means RequesterOptions.SettleStrategy=PreSettled is silently ignored. Either pass through the requested settle strategy (and adjust requester reply handling accordingly), or validate that only ExplicitSettle/DirectReplyTo are allowed for requesters and return an error otherwise.

Suggested change
settleStrategy := ExplicitSettle
if options.SettleStrategy == DirectReplyTo {
settleStrategy = DirectReplyTo
var settleStrategy SettleStrategy
switch options.SettleStrategy {
case 0, ExplicitSettle:
// Default (zero) or explicit ExplicitSettle: use ExplicitSettle to preserve existing behavior.
settleStrategy = ExplicitSettle
case DirectReplyTo:
// Pass through DirectReplyTo unchanged.
settleStrategy = DirectReplyTo
default:
// Unsupported strategy for requesters: clean up and return an error instead of silently coercing.
_ = publisher.Close(ctx)
return nil, fmt.Errorf("unsupported settle strategy for requester: %v", options.SettleStrategy)

Copilot uses AI. Check for mistakes.
Comment on lines +127 to +128
// Use ExplicitSettle for a dedicated reply queue (default).
// Use DirectReplyTo to enable RabbitMQ direct-reply-to (no reply queue declared).
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

RequesterOptions.SettleStrategy uses ConsumerSettleStrategy, which also contains PreSettled, but the requester implementation always calls Accept()/Requeue() on replies. Consider documenting which strategies are actually supported for requesters (e.g., ExplicitSettle and DirectReplyTo only) or using a requester-specific enum to prevent unsupported values.

Suggested change
// Use ExplicitSettle for a dedicated reply queue (default).
// Use DirectReplyTo to enable RabbitMQ direct-reply-to (no reply queue declared).
//
// Supported values for requesters:
// - ExplicitSettle (default): use a dedicated reply queue and explicitly settle replies
// via Accept()/Requeue().
// - DirectReplyTo: enable RabbitMQ direct-reply-to (no reply queue declared).
//
// Note: PreSettled is not supported for requesters; replies are always explicitly settled.

Copilot uses AI. Check for mistakes.
Gsantomaggio and others added 2 commits February 10, 2026 11:43
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
@Gsantomaggio Gsantomaggio merged commit 3f5cc3a into main Feb 10, 2026
2 checks passed
@Gsantomaggio Gsantomaggio deleted the change/consumer_feature branch February 10, 2026 11:06
@Gsantomaggio Gsantomaggio added enhancement New feature or request breaking change Introduces a breaking change labels Feb 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Introduces a breaking change enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants