-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Add EventHubs Service Connection for Docker Compose and Testcontainers #47926
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
70ad606
Initial plan
Copilot 04638fe
Add EventHubs ConnectionDetails support for autoconfigure, testcontai…
Copilot 2acc1c1
Add test cases for EventHubs ConnectionDetails support
Copilot 16a9303
Fix pipeline failure
rujche 0411234
Remove AzureServiceConfigurationBase in AzureServiceBusAutoConfiguration
rujche 170050a
Fix version error
rujche 3a41b86
Add docker compose timtout
rujche ac3b756
Fix the mount path
rujche 3623951
Update the ports and volumes
rujche 7fc8e13
Update namespace
rujche 40bf4bb
Add azurite in eventhubs-compose.yaml
rujche 8ac5324
Update
rujche d0c2947
Add AZURITE in EventHubsContainerConnectionDetailsFactoryTests
rujche e65c718
Wait more time
rujche b54d0dd
Revert "Wait more time"
rujche 0b6b79c
Add withEnv
rujche 5e9d947
Use withAzuriteContainer
rujche c7ccc4c
Fix test failure
rujche c4347fb
Fix lint error
rujche e3d1570
Fix lint error
rujche ae9ab9a
Resolve PR comment, fix test failure
rujche 79ddbf6
Resolve PR comment
rujche 57e32bb
Merge branch 'main' into copilot/add-support-connectiondetails
rujche af6d5a3
Resolve comment, fix test failures.
rujche e474843
Merge branch 'copilot/add-support-connectiondetails' of github.com:Az…
rujche f1ecc0a
Resolve PR comments
rujche 2c95cc2
Add @ConditionalOnBean(AzureEventHubsProperties.class) guard to BlobC…
rujche e54fff2
Change scope to test to avoid change in api view
rujche db3dfd8
Add test about connectionDetails bean
rujche a9b567c
Update test name
rujche 768f81b
Make AzureCosmosAutoConfiguration consistant with eventhubs and servi…
rujche 508a748
Configure StaticConnectionStringProvider when using ConnectionDetails
rujche 2a82b14
Fix un failure
rujche File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
12 changes: 12 additions & 0 deletions
12
...ud/autoconfigure/implementation/eventhubs/properties/AzureEventHubsConnectionDetails.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| package com.azure.spring.cloud.autoconfigure.implementation.eventhubs.properties; | ||
|
|
||
| import org.springframework.boot.autoconfigure.service.connection.ConnectionDetails; | ||
|
|
||
| public interface AzureEventHubsConnectionDetails extends ConnectionDetails { | ||
|
|
||
| String getConnectionString(); | ||
|
|
||
| } |
15 changes: 15 additions & 0 deletions
15
...oconfigure/implementation/eventhubs/properties/AzureEventHubsPropertiesConfiguration.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| package com.azure.spring.cloud.autoconfigure.implementation.eventhubs.properties; | ||
|
|
||
| import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
| import org.springframework.context.annotation.Import; | ||
|
|
||
| @Import({ | ||
| ConfigurationWithConnectionDetailsBean.class, | ||
| ConfigurationWithoutConnectionDetailsBean.class, | ||
| }) | ||
| @EnableConfigurationProperties | ||
| public class AzureEventHubsPropertiesConfiguration { | ||
| } |
46 changes: 46 additions & 0 deletions
46
...configure/implementation/eventhubs/properties/ConfigurationWithConnectionDetailsBean.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| package com.azure.spring.cloud.autoconfigure.implementation.eventhubs.properties; | ||
|
|
||
| import com.azure.spring.cloud.autoconfigure.implementation.context.properties.AzureGlobalProperties; | ||
| import com.azure.spring.cloud.autoconfigure.implementation.properties.utils.AzureGlobalPropertiesUtils; | ||
| import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; | ||
| import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; | ||
| import org.springframework.boot.autoconfigure.service.connection.ConnectionDetails; | ||
| import org.springframework.boot.context.properties.bind.BindResult; | ||
| import org.springframework.boot.context.properties.bind.Bindable; | ||
| import org.springframework.boot.context.properties.bind.Binder; | ||
| import org.springframework.context.annotation.Bean; | ||
| import org.springframework.core.env.Environment; | ||
|
|
||
| @ConditionalOnClass(ConnectionDetails.class) | ||
| @ConditionalOnBean(AzureEventHubsConnectionDetails.class) | ||
| class ConfigurationWithConnectionDetailsBean { | ||
|
|
||
| private final Environment environment; | ||
| private final AzureGlobalProperties globalProperties; | ||
| private final AzureEventHubsConnectionDetails connectionDetails; | ||
|
|
||
| ConfigurationWithConnectionDetailsBean( | ||
| Environment environment, | ||
| AzureGlobalProperties globalProperties, | ||
| AzureEventHubsConnectionDetails connectionDetails) { | ||
| this.environment = environment; | ||
| this.globalProperties = globalProperties; | ||
| this.connectionDetails = connectionDetails; | ||
| } | ||
|
|
||
| @Bean | ||
| AzureEventHubsProperties azureEventHubsProperties() { | ||
| AzureEventHubsProperties propertiesLoadFromGlobalProperties = | ||
| AzureGlobalPropertiesUtils.loadProperties(globalProperties, new AzureEventHubsProperties()); | ||
| BindResult<AzureEventHubsProperties> bindResult = Binder.get(environment) | ||
| .bind(AzureEventHubsProperties.PREFIX, Bindable.ofInstance(propertiesLoadFromGlobalProperties)); | ||
| AzureEventHubsProperties properties = bindResult.isBound() ? bindResult.get() | ||
| : propertiesLoadFromGlobalProperties; | ||
| properties.setConnectionString(connectionDetails.getConnectionString()); | ||
| return properties; | ||
| } | ||
|
|
||
| } |
32 changes: 32 additions & 0 deletions
32
...figure/implementation/eventhubs/properties/ConfigurationWithoutConnectionDetailsBean.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| package com.azure.spring.cloud.autoconfigure.implementation.eventhubs.properties; | ||
|
|
||
| import com.azure.spring.cloud.autoconfigure.implementation.condition.ConditionalOnAnyProperty; | ||
| import com.azure.spring.cloud.autoconfigure.implementation.context.properties.AzureGlobalProperties; | ||
| import com.azure.spring.cloud.autoconfigure.implementation.properties.utils.AzureGlobalPropertiesUtils; | ||
| import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; | ||
| import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
| import org.springframework.boot.context.properties.ConfigurationProperties; | ||
| import org.springframework.context.annotation.Bean; | ||
|
|
||
| @ConditionalOnMissingBean(type = "com.azure.spring.cloud.autoconfigure.implementation.eventhubs.properties.AzureEventHubsConnectionDetails") | ||
| @ConditionalOnProperty(value = "spring.cloud.azure.eventhubs.enabled", havingValue = "true", matchIfMissing = true) | ||
| @ConditionalOnAnyProperty(prefix = "spring.cloud.azure.eventhubs", name = {"connection-string", "namespace"}) | ||
| class ConfigurationWithoutConnectionDetailsBean { | ||
|
|
||
| private final AzureGlobalProperties azureGlobalProperties; | ||
|
|
||
| ConfigurationWithoutConnectionDetailsBean(AzureGlobalProperties azureGlobalProperties) { | ||
| this.azureGlobalProperties = azureGlobalProperties; | ||
| } | ||
|
|
||
| @Bean | ||
| @ConditionalOnMissingBean | ||
| @ConfigurationProperties(AzureEventHubsProperties.PREFIX) | ||
| AzureEventHubsProperties azureEventHubsProperties() { | ||
| return AzureGlobalPropertiesUtils.loadProperties(azureGlobalProperties, new AzureEventHubsProperties()); | ||
| } | ||
|
|
||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.