Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 14, 2025

Description

Adds unit test verifying that Spring Cloud Azure Service Bus JMS correctly configures CachingConnectionFactory to cache and reuse MessageProducer and MessageConsumer instances for the same destination.

Changes

  • New test: cachingConnectionFactoryCachesProducersAndConsumersForSameDestination in ServiceBusJmsConnectionFactoryConfigurationTests
    • Verifies isCacheProducers() returns true when cache properties are enabled
    • Verifies isCacheConsumers() returns true when cache properties are enabled
    • Parameterized for both standard and premium pricing tiers

The test ensures Spring Framework's CachingConnectionFactory will cache producers/consumers as documented in CachingConnectionFactory.java#L362 and L427.

Fixes #issue_number

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • oss.jfrog.org
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED -classpath /usr/share/apache-maven-3.9.11/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/usr/share/apache-maven-3.9.11/bin/m2.conf -Dmaven.home=/usr/share/apache-maven-3.9.11 -Dlibrary.jansi.path=/usr/share/apache-maven-3.9.11/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/azure-sdk-for-java/azure-sdk-for-java/sdk/spring/spring-cloud-azure-autoconfigure org.codehaus.plexus.classworlds.launcher.Launcher test -Dtest=ServiceBusJmsConnectionFactoryConfigurationTests#cachingConnectionFactoryCachesProducersAndConsumersForSameDestination -DfailIfNoTests=false (dns block)
  • test-namespace.servicebus.windows.net
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java -javaagent:/home/REDACTED/.m2/repository/org/jacoco/org.jacoco.agent/0.8.13/org.jacoco.agent-0.8.13-runtime.jar=destfile=/home/REDACTED/work/azure-sdk-for-java/azure-sdk-for-java/sdk/spring/spring-cloud-azure-autoconfigure/target/jacoco-unit.exec,excludes=META-INF/** -Xmx4096m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/home/REDACTED/work/azure-sdk-for-java/azure-sdk-for-java/sdk/spring/spring-cloud-azure-autoconfigure/target/spring-cloud-azure-autoconfigure-oom.hprof -XX:+CrashOnOutOfMemoryError --add-opens java.base/java.lang.invoke=com.azure.core org.apache.maven.surefire.booter.ForkedBooter /home/REDACTED/work/azure-sdk-for-java/azure-sdk-for-java/sdk/spring/spring-cloud-azure-autoconfigure/target/surefire 2025-11-14T08-58-38_759-jvmRun1 surefire-20251114085840322_1tmp surefire_0-20251114085840322_2tmp (dns block)
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java -javaagent:/home/REDACTED/.m2/repository/org/jacoco/org.jacoco.agent/0.8.13/org.jacoco.agent-0.8.13-runtime.jar=destfile=/home/REDACTED/work/azure-sdk-for-java/azure-sdk-for-java/sdk/spring/spring-cloud-azure-autoconfigure/target/jacoco-unit.exec,excludes=META-INF/** -Xmx4096m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/home/REDACTED/work/azure-sdk-for-java/azure-sdk-for-java/sdk/spring/spring-cloud-azure-autoconfigure/target/spring-cloud-azure-autoconfigure-oom.hprof -XX:+CrashOnOutOfMemoryError --add-opens java.base/java.lang.invoke=com.azure.core org.apache.maven.surefire.booter.ForkedBooter /home/REDACTED/work/azure-sdk-for-java/azure-sdk-for-java/sdk/spring/spring-cloud-azure-autoconfigure/target/surefire 2025-11-14T09-05-27_458-jvmRun1 surefire-20251114090527520_1tmp surefire_0-20251114090527520_2tmp (dns block)
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java -javaagent:/home/REDACTED/.m2/repository/org/jacoco/org.jacoco.agent/0.8.13/org.jacoco.agent-0.8.13-runtime.jar=destfile=/home/REDACTED/work/azure-sdk-for-java/azure-sdk-for-java/sdk/spring/spring-cloud-azure-autoconfigure/target/jacoco-unit.exec,excludes=META-INF/** -Xmx4096m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/home/REDACTED/work/azure-sdk-for-java/azure-sdk-for-java/sdk/spring/spring-cloud-azure-autoconfigure/target/spring-cloud-azure-autoconfigure-oom.hprof -XX:+CrashOnOutOfMemoryError --add-opens java.base/java.lang.invoke=com.azure.core org.apache.maven.surefire.booter.ForkedBooter /home/REDACTED/work/azure-sdk-for-java/azure-sdk-for-java/sdk/spring/spring-cloud-azure-autoconfigure/target/surefire 2025-11-14T09-14-40_918-jvmRun1 surefire-20251114091440979_1tmp surefire_0-20251114091440979_2tmp (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>[FEATURE REQ] Add UT for Spring Cloud Azure</issue_title>
<issue_description>Is your feature request related to a problem? Please describe.
Add a new UT to make sure when using Spring Cloud Azure Service Bus JMS, with CachingConnectionFactory mode , the same object is always used when creating producers/consumers for the same destination.

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
https://github.com/spring-projects/spring-framework/blob/92a186b44b4e58a9932c23fe71c243b5e944160a/spring-jms/src/main/java/org/springframework/jms/connection/CachingConnectionFactory.java#L362

https://github.com/spring-projects/spring-framework/blob/92a186b44b4e58a9932c23fe71c243b5e944160a/spring-jms/src/main/java/org/springframework/jms/connection/CachingConnectionFactory.java#L427

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • Description Added
  • Expected solution specified
    </issue_description>

Comments on the Issue (you are @copilot in this section)


💡 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.

…nFactory behavior

Verify that when using CachingConnectionFactory mode, producer and consumer
caching is properly configured for reusing MessageProducer and MessageConsumer
instances for the same destination.

Test covers both standard and premium pricing tiers.

Co-authored-by: Netyyyy <[email protected]>
Copilot AI changed the title [WIP] Add unit test for Spring Cloud Azure Service Bus JMS Add unit test for CachingConnectionFactory producer/consumer reuse in Spring Cloud Azure Service Bus JMS Nov 14, 2025
Copilot AI requested a review from Netyyyy November 14, 2025 09:26
Copilot finished work on behalf of Netyyyy November 14, 2025 09:26
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.

[FEATURE REQ] Add UT for Spring Cloud Azure

2 participants