Implement comprehensive JMS ConnectionFactory configuration for Service Bus#47950
Merged
Conversation
…iver ConnectionFactory Co-authored-by: rujche <171773178+rujche@users.noreply.github.com>
Co-authored-by: rujche <171773178+rujche@users.noreply.github.com>
Co-authored-by: rujche <171773178+rujche@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Change sender's default JmsConnectionFactory to CachingConnectionFactory
Use CachingConnectionFactory by default for Service Bus JMS sender operations
Feb 10, 2026
The receiver now conditionally uses the ConnectionFactory bean when it's JmsPoolConnectionFactory or CachingConnectionFactory, otherwise creates a dedicated ServiceBusJmsConnectionFactory. This matches the expected behavior where the receiver should use the same pooled/cached connection factory as the sender when those features are enabled. Co-authored-by: rujche <171773178+rujche@users.noreply.github.com>
rujche
reviewed
Feb 10, 2026
The receiver now only uses the shared ConnectionFactory bean when pooling or caching is EXPLICITLY enabled. When properties are not set, the receiver creates a dedicated ServiceBusJmsConnectionFactory instance, even though the sender defaults to CachingConnectionFactory. This matches the expected behavior table from the issue. Co-authored-by: rujche <171773178+rujche@users.noreply.github.com>
Member
Table
Explanation
@copilot , According to this table and explanation:
|
- Updated logic to follow the complete configuration table with all 9 scenarios - Added JavaDoc tables to both sender and receiver configurations - Added comprehensive test coverage for all scenarios - Updated CHANGELOG with detailed configuration table and rules - Both properties set to true now uses CachingConnectionFactory (cache takes precedence) - Added proper fallback logic when required classes are not in classpath Co-authored-by: rujche <171773178+rujche@users.noreply.github.com>
Contributor
Author
Done in commit 29cb8b3:
Key changes:
|
Copilot
AI
changed the title
Use CachingConnectionFactory by default for Service Bus JMS sender operations
Implement comprehensive JMS ConnectionFactory configuration for Service Bus
Feb 10, 2026
Member
|
@copilot Fix the lint error: |
Fixed OperatorWrapCheck violations by moving && operators from end of line to the beginning of the next line, following the project's code style rules. Co-authored-by: rujche <171773178+rujche@users.noreply.github.com>
Contributor
Author
Member
|
Fix this failure: |
Added static Logger field and imported slf4j Logger and LoggerFactory to fix compilation errors where LOGGER was referenced but not declared in the ServiceBusJmsContainerConfiguration class. Co-authored-by: rujche <171773178+rujche@users.noreply.github.com>
Contributor
Author
Fixed in commit a81e2bb. Added the missing |
Member
|
@copilot apply changes based on the comments in this thread |
Changed Class.forName from "JmsProperties$Pool" to "JmsPoolConnectionFactoryProperties" which is the correct type expected by JmsPoolConnectionFactoryFactory constructor. This matches the usage in ServiceBusJmsConnectionFactoryConfiguration where serviceBusJmsProperties.getPool() returns JmsPoolConnectionFactoryProperties. Co-authored-by: rujche <171773178+rujche@users.noreply.github.com>
Member
|
/azp run java - spring - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
saragluna
reviewed
Feb 13, 2026
Changed all occurrences of "receiver" to "listenerContainer" for better alignment with Spring JMS terminology. This affects: - JavaDoc table headers - Code comments - Test descriptions - CHANGELOG table column header This makes the code more clear and consistent with Spring JMS naming conventions. Co-authored-by: rujche <171773178+rujche@users.noreply.github.com>
rujche
reviewed
Feb 24, 2026
rujche
reviewed
Feb 24, 2026
Renamed method from getReceiverConnectionFactory to getConnectionFactory, parameter from connectionFactory to beanConnectionFactory, and local variable from receiverConnectionFactory to listenerConnectionFactory for better code clarity and to avoid naming conflicts. Co-authored-by: rujche <171773178+rujche@users.noreply.github.com>
Renamed all 4 test method names to use "listenerContainer" prefix instead of "receiver" for consistency with Spring JMS terminology: - receiverUsesDedicatedServiceBusConnectionFactoryByDefault - receiverUsesCachingConnectionFactoryWhenExplicitlyEnabled - receiverUsesPoolConnectionFactoryWhenExplicitlyEnabled - receiverUsesDedicatedServiceBusConnectionFactoryWhenPoolDisabled Co-authored-by: rujche <171773178+rujche@users.noreply.github.com>
Member
|
/azp run java - spring - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Netyyyy
approved these changes
Mar 6, 2026
Member
|
/check-enforcer override |
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.
Plan: Change sender's default JmsConnectionFactory to CachingConnectionFactory
Understanding:
spring.jms.servicebus.pool.enabledandspring.jms.cache.enabledare not set, both sender and listener container useServiceBusJmsConnectionFactoryJmsTemplateas each send creates and closes a connectionCachingConnectionFactoryby default for the sender sideImplementation Strategy:
ServiceBusJmsConnectionFactoryConfiguration.javato implement complete configuration matrixServiceBusJmsContainerConfiguration.javato match all scenariosOriginal prompt
This section details on the original issue you should resolve
<issue_title>[FEATURE REQ] Change sender's default JmsConnectionFactory from ServiceBusJmsConnectionFactory to CachingConnectionFactory</issue_title>
<issue_description>## Current behavior
Expected behavior
Comment from @vinaysurya
Relate codes
azure-sdk-for-java/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/implementation/jms/ServiceBusJmsContainerConfiguration.java
Lines 29 to 48 in d9d47b6
azure-sdk-for-java/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/implementation/jms/ServiceBusJmsConnectionFactoryConfiguration.java
Lines 59 to 72 in 1ab5874
Comments on the Issue (you are @copilot in this section)
@rujche ## Current statusJmsTemplatebean.JmsTemplatebean will only be configured when there is only one bean with typeConnectionFactory.@ConditionalOnSingleCandidate(ConnectionFactory.class).ConnectionFactory, it's the same one used in spring-boot/../JmsClientConfigurations.javaImplementation suggestion
ConnectionFactory, to make the spring-boot/../JmsClientConfigurations.java can still work.💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.