Skip to content

feat: auto-detect channelName from @RabbitListener#1633

Merged
timonback merged 4 commits intospringwolf:mainfrom
therev2:feature/auto-detect-channel-name-from-rabbit-listener
Feb 20, 2026
Merged

feat: auto-detect channelName from @RabbitListener#1633
timonback merged 4 commits intospringwolf:mainfrom
therev2:feature/auto-detect-channel-name-from-rabbit-listener

Conversation

@therev2
Copy link
Contributor

@therev2 therev2 commented Feb 13, 2026

Makes @AsyncOperation.channelName optional. When left blank, the channel name is automatically inferred from @RabbitListener (queues, bindings) on the same method.

  • Adds ChannelNameInferrer SPI and ChannelNameResolver in core
  • Adds RabbitListenerChannelNameInferrer for AMQP
  • Fully backward-compatible
  • Includes unit tests

Fixes #1427

…syncOperation. Adds ChannelNameInferrer SPI, ChannelNameResolver, and RabbitListenerChannelNameInferrer with tests.
Copilot AI review requested due to automatic review settings February 13, 2026 19:08
@netlify
Copy link

netlify bot commented Feb 13, 2026

Deploy Preview for springwolf-ui canceled.

Name Link
🔨 Latest commit f771ce4
🔍 Latest deploy log https://app.netlify.com/projects/springwolf-ui/deploys/69989558c942f20008415ee0

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

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.

Copy link
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

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 ChannelNameInferrer SPI and ChannelNameResolver in core for protocol-agnostic channel name inference
  • Implements RabbitListenerChannelNameInferrer for AMQP plugin to auto-detect from @RabbitListener queues, queuesToDeclare, and bindings
  • Makes @AsyncOperation.channelName optional 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.

@timonback
Copy link
Member

Hi @therev2
This looks promising, will do a deeper review on Friday.
Relates to #1427

change AsyncAnnotationChannelServiceTest to pure unit tests as inferring is covered by ChannelNameResolverTest
@timonback timonback merged commit 367f28a into springwolf:main Feb 20, 2026
26 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.

auto-detect "channelName"

3 participants