Skip to content

Add NamingSource.FromHandlerType for conventional routing#2367

Merged
jeremydmiller merged 2 commits intomainfrom
handler-type-naming-convention
Mar 29, 2026
Merged

Add NamingSource.FromHandlerType for conventional routing#2367
jeremydmiller merged 2 commits intomainfrom
handler-type-naming-convention

Conversation

@jeremydmiller
Copy link
Copy Markdown
Member

Summary

Closes #2359

Adds NamingSource.FromHandlerType — an alternative naming mode for conventional routing that names listener queues/topics after the handler type instead of the message type. This is useful for modular monolith scenarios where multiple handlers exist for the same message type and each needs its own dedicated queue to receive messages independently.

Changes

  • New NamingSource enum with FromMessageType (default, existing behavior) and FromHandlerType
  • MessageRoutingConvention base class — added UseNaming(NamingSource) method and modified DiscoverListeners() to create per-handler-type listener endpoints when FromHandlerType is selected, with StickyHandlers to ensure only the matching handler processes messages from each queue
  • New UseConventionalRouting(NamingSource, ...) overloads on all transports with conventional routing:
    • RabbitMQ
    • Azure Service Bus (queue and topic/subscription variants)
    • AWS SQS
    • GCP Pub/Sub
  • Tests for each transport verifying handler-type-based naming
  • Documentation updated for all 4 transports explaining the new option and when to use it

Usage

opts.UseRabbitMq()
    .UseConventionalRouting(NamingSource.FromHandlerType);

Test plan

  • 3 new RabbitMQ handler type naming tests pass
  • All 26 RabbitMQ conventional routing tests pass (no regressions)
  • All 1196 CoreTests pass
  • All 4 transport test projects build successfully (Azure SB, AWS SQS, GCP Pub/Sub, RabbitMQ)

🤖 Generated with Claude Code

jeremydmiller and others added 2 commits March 29, 2026 09:52
Adds an alternative naming mode for conventional routing that names
listener queues/topics after the handler type instead of the message
type. This is useful for modular monolith scenarios where multiple
handlers exist for the same message type and each needs its own
dedicated queue to receive messages independently.

New NamingSource enum with FromMessageType (default) and FromHandlerType.
Added UseConventionalRouting(NamingSource) overloads to all transports
that support conventional routing: RabbitMQ, Azure Service Bus (queue
and topic/subscription), AWS SQS, and GCP Pub/Sub.

Closes #2359

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…tion

SQS replaces dots with hyphens, Azure SB lowercases names. Tests now
account for these transport-specific name sanitizations.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jeremydmiller jeremydmiller merged commit fefa829 into main Mar 29, 2026
18 of 20 checks passed
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.

An option to name the listener queue after the handler type instead of the message type in all cases

1 participant