Repository navigation
FromHandlerType routing: create listeners for separated handler chains, not just the saga (#3041) - #3042
Merged
jeremydmiller merged 1 commit intoJun 5, 2026
Conversation
…handler chains too (GH-3041) When a message is handled by more than one handler under MultipleHandlerBehavior.Separated and one of them is a saga (e.g. a Start method), only the saga stays in chain.Handlers - the sibling handlers are moved to separated chains in chain.ByEndpoint. MessageRoutingConvention.DiscoverListeners' FromHandlerType branch iterated only chain.Handlers, so it created a handler-named listener for the saga but none for the separated regular handler. With conventional local routing disabled, the regular handler's message never arrived (no queue/listener for it) - only the saga ran. Fix: the FromHandlerType branch now also creates a handler-named listener for each chain.ByEndpoint chain, registers the endpoint on that chain, and marks it sticky - mirroring what the Separated branch already does. The branch is also entered when there are only ByEndpoint chains. Reproduced from the issue's repo (RabbitMQ + UseConventionalRouting(FromHandlerType) + DisableConventionalLocalRouting + Separated, a saga Start and a regular Handle for one message). Root cause pinned by inspecting the SagaChain: chain.Handlers = [saga], chain.ByEndpoint = [regular handler]. New RabbitMQ regression test asserts both handler-named queues exist and have active listeners; verified it fails (regular-handler queue missing) without the fix. RabbitMQ conventional-routing (34), MessageRoutingTests (25), and CoreTests saga/separated (66) all green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jun 8, 2026
This was referenced Jul 15, 2026
This was referenced Jul 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3041.
Reproduction
From the reporter's repo: RabbitMQ +
UseConventionalRouting(NamingSource.FromHandlerType)+DisableConventionalLocalRouting()+MultipleHandlerBehavior.Separated, with a message handled by both a saga (aStartmethod) and a regular handler. Only the saga ran; the regular handler never received the message.I reproduced it broker-free by inspecting the
SagaChainfor the shared message type:(The reporter's own diagnostic —
runtime.RoutingFor(messageType).Routes— points at the sender/exchange side; the actual missing piece is on the listener side, which the endpoint/queue diagnostics surface: only the saga's queue gets created.)Root cause
Under
MultipleHandlerBehavior.Separated, when a message has multiple handlers and one is a saga, only the saga stays inchain.Handlers— the sibling handlers are moved to separated chains inchain.ByEndpoint.MessageRoutingConvention.DiscoverListeners'FromHandlerTypebranch iterated onlychain.Handlers, so it created a handler-named listener queue for the saga but none for the separated regular handler. With conventional local routing disabled, that handler had no queue/listener and never received the message. (TheSeparatedbranch handlesByEndpoint, butFromHandlerTypetakes the earlierifand never reaches it.)Fix
The
FromHandlerTypebranch now also creates a handler-named listener for eachchain.ByEndpointchain — registering the endpoint on that chain and marking it sticky, mirroring what theSeparatedbranch already does — and is entered when there are onlyByEndpointchains too. One small change inMessageRoutingConvention.Tests
New RabbitMQ regression
Bug_3041_saga_and_handler_with_handler_type_naming(mirrors the repro): asserts both the saga's and the regular handler's handler-named queues exist and have active listeners. Verified it fails (regular-handler queue missing) without the fix.🤖 Generated with Claude Code