feat: auto-detect channelName from @RabbitListener#1633
Merged
timonback merged 4 commits intospringwolf:mainfrom Feb 20, 2026
Merged
Conversation
…syncOperation. Adds ChannelNameInferrer SPI, ChannelNameResolver, and RabbitListenerChannelNameInferrer with tests.
✅ Deploy Preview for springwolf-ui canceled.
|
There was a problem hiding this comment.
Welcome to Springwolf. Thanks a lot for creating your first pull request. Please check out our contributors guide and feel free to join us on discord.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces automatic channel name detection for @AsyncOperation from broker-specific listener annotations, making the channelName attribute optional. When @AsyncOperation.channelName is left blank, Springwolf now automatically infers it from annotations like @RabbitListener.
Changes:
- Adds
ChannelNameInferrerSPI andChannelNameResolverin core for protocol-agnostic channel name inference - Implements
RabbitListenerChannelNameInferrerfor AMQP plugin to auto-detect from@RabbitListenerqueues, queuesToDeclare, and bindings - Makes
@AsyncOperation.channelNameoptional with empty string default, maintaining full backward compatibility
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/annotations/AsyncOperation.java | Makes channelName optional with default empty string and adds documentation |
| springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/common/channel/ChannelNameInferrer.java | Defines SPI for protocol-specific channel name inference |
| springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/common/channel/ChannelNameResolver.java | Implements resolution logic: explicit channelName → inferrers → error |
| springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/common/channel/AsyncAnnotationChannelService.java | Integrates ChannelNameResolver for channel building |
| springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/common/operation/AsyncAnnotationOperationService.java | Integrates ChannelNameResolver for operation building |
| springwolf-core/src/main/java/io/github/springwolf/core/configuration/SpringwolfScannerConfiguration.java | Wires ChannelNameResolver bean and updates all scanner beans |
| springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/common/channel/ChannelNameResolverTest.java | Comprehensive tests for resolution logic including edge cases |
| springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/common/channel/AsyncAnnotationChannelServiceTest.java | Tests channel service integration with inference |
| springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/common/operation/AsyncAnnotationOperationServiceTest.java | Updates operation service test to include ChannelNameResolver |
| springwolf-plugins/springwolf-amqp-plugin/src/main/java/io/github/springwolf/plugins/amqp/asyncapi/scanners/common/RabbitListenerChannelNameInferrer.java | AMQP-specific inferrer using RabbitListenerUtil.getChannelName |
| springwolf-plugins/springwolf-amqp-plugin/src/main/java/io/github/springwolf/plugins/amqp/configuration/SpringwolfAmqpScannerConfiguration.java | Registers RabbitListenerChannelNameInferrer bean conditionally |
| springwolf-plugins/springwolf-amqp-plugin/src/test/java/io/github/springwolf/plugins/amqp/asyncapi/scanners/common/RabbitListenerChannelNameInferrerTest.java | Tests inference from queues, queuesToDeclare, and bindings with routing keys |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
change AsyncAnnotationChannelServiceTest to pure unit tests as inferring is covered by ChannelNameResolverTest
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.
Makes
@AsyncOperation.channelNameoptional. When left blank, the channel name is automatically inferred from@RabbitListener(queues, bindings) on the same method.Fixes #1427