Fix Service Bus autoconfiguration for dedicated producer/consumer/processor connection details#49257
Conversation
… details Agent-Logs-Url: https://github.com/Azure/azure-sdk-for-java/sessions/46f525ea-fb3b-4a1a-a68b-1699ceb5be19 Co-authored-by: rujche <171773178+rujche@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Fixes a Spring Cloud Azure Service Bus autoconfiguration regression where providing only nested connection details (producer/consumer/processor) prevented AzureServiceBusProperties from being created, causing downstream bean creation to fail.
Changes:
- Expanded
ConfigurationWithoutConnectionDetailsBeanactivation to also match nested Service Bus connection properties (producer/consumer/processor namespace/connection-string). - Guarded
AzureServiceBusClientBuilderConfiguration#serviceBusClientBuilder(...)to avoid callingfactory.build()when no top-level connection info (and no shared connection-string provider) exists. - Added an auto-configuration regression test verifying producer-only dedicated connection-string configuration works without any top-level connection info.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/implementation/servicebus/AzureServiceBusAutoConfigurationTests.java | Adds regression test ensuring dedicated producer configuration can initialize without top-level Service Bus connection info. |
| sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/implementation/servicebus/properties/ConfigurationWithoutConnectionDetailsBean.java | Broadens property-based activation to include nested producer/consumer/processor connection settings. |
| sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/implementation/servicebus/AzureServiceBusClientBuilderConfiguration.java | Prevents global builder creation from failing when top-level namespace/connection-string are absent. |
…processor Agent-Logs-Url: https://github.com/Azure/azure-sdk-for-java/sessions/b427b614-03be-4f37-8224-084e99299ed8 Co-authored-by: rujche <171773178+rujche@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. 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:
If you need me to access, download, or install something from one of these locations, you can either:
|
…mespace-only variants Agent-Logs-Url: https://github.com/Azure/azure-sdk-for-java/sessions/c1ddba8c-d678-46f0-b6fc-a95612e9ce1d Co-authored-by: rujche <171773178+rujche@users.noreply.github.com>
|
@copilot , Update |
…n fix Agent-Logs-Url: https://github.com/Azure/azure-sdk-for-java/sessions/7d40951d-738e-4b6d-9d32-15abec75298e Co-authored-by: rujche <171773178+rujche@users.noreply.github.com>
Updated |
|
/azp run java - spring - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
This pull request improves the Service Bus autoconfiguration in the
spring-cloud-azure-autoconfiguremodule, enabling applications to initialize dedicated producer, consumer, or processor clients using only sub-level Service Busnamespaceorconnection-stringproperties, without requiring top-level Service Bus connection configuration. The changes also expand test coverage to ensure this behavior and update the conditions for bean creation accordingly.Service Bus Autoconfiguration Improvements:
AzureServiceBusClientBuilderConfigurationto allow initialization of Service Bus clients (producer, consumer, processor) when only sub-level (producer,consumer, orprocessor)namespaceorconnection-stringproperties are set, even if top-level Service Bus connection properties are not provided.ConfigurationWithoutConnectionDetailsBeanto include sub-level (producer,consumer,processor)namespaceandconnection-stringproperties, ensuring beans are created when only these are present.Testing Enhancements:
AzureServiceBusAutoConfigurationTeststo verify that Service Bus producer, consumer, and processor clients can be configured and initialized with only their respective sub-level connection properties, without requiring top-level connection information.Documentation:
CHANGELOG.mdto document the fix allowing dedicated Service Bus clients to initialize with only sub-level configuration.Dependency Updates:
ServiceBusSenderClient,ServiceBusReceiverClient, andServiceBusProcessorClientin the test file to support new test cases.StringUtilsto support new logic in the autoconfiguration class.