Skip to content
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

Make storage account optional in the eventhub binder configuration. #23640

Merged
merged 7 commits into from
Sep 1, 2021

Conversation

ZhuXiaoBing-cn
Copy link
Contributor

  • Fix that when there is the only producer, make storage account optional.

@ghost ghost added the azure-spring All azure-spring related issues label Aug 18, 2021
@ZhuXiaoBing-cn ZhuXiaoBing-cn self-assigned this Aug 18, 2021
@ZhuXiaoBing-cn ZhuXiaoBing-cn linked an issue Aug 18, 2021 that may be closed by this pull request
@ZhuXiaoBing-cn ZhuXiaoBing-cn added azure-spring-eventhubs Spring event hubs related issues. Client This issue points to a problem in the data-plane of the library. labels Aug 18, 2021
@yiliuTo yiliuTo added this to the [2021] September milestone Aug 18, 2021
@stliu
Copy link
Member

stliu commented Aug 26, 2021

I don't think this fix the issue, for example com.azure.spring.cloud.autoconfigure.eventhub.AzureEventHubProperties#checkpointStorageAccount has a validation to check if the blob storage is provided

and there is not test case to verify if this is fixed or not

)
.run(context -> {
assertThat(context).hasSingleBean(EventHubClientFactory.class);
EventHubClientFactory eventHubClientFactory =
Copy link
Member

Choose a reason for hiding this comment

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

I think it's not necessary to check the eventHubClientFactory object, but we need to make sure beans of EventHubOperation and EventHubNamespaceManager exist and should not have a bean of StorageAccountManager.

@@ -127,6 +126,10 @@ private String getStorageConnectionString(AzureEventHubProperties properties,
final String accountKey = properties.getCheckpointAccessKey();
final StorageConnectionStringProvider provider;

if (accountName == null) {
Copy link
Member

Choose a reason for hiding this comment

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

We could also add a condition on bean of StorageAccountManager, with the rely on property of account-name.

private AzureProperties azureProperties;

private ApplicationContextRunner contextRunner = new ApplicationContextRunner()
.withPropertyValues(EVENT_HUB_PROPERTY_PREFIX + "connection-string=Endpoint=sb://eventhub-test-1"
Copy link
Member

Choose a reason for hiding this comment

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

We could add UTs with other types of credential configuration, and make sure it could work without storage configs.

@@ -105,6 +105,38 @@ public void testResourceManagerProvided() {
});
}

@Test
public void testEventHubOperationProvidedNotStorageUnder () {
Copy link
Member

Choose a reason for hiding this comment

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

Seems the method name is not integral?

AZURE_PROPERTY_PREFIX + "subscription-id=sub"
)
.run(context -> {
assertThat(context).hasSingleBean(EventHubNamespaceManager.class);
Copy link
Member

Choose a reason for hiding this comment

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

We should check StorageAccountManager bean here and for below test.

* Check StorageAccountManager bean is in unit tests.
@yiliuTo
Copy link
Member

yiliuTo commented Aug 27, 2021

/azp run java - spring - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@yiliuTo yiliuTo left a comment

Choose a reason for hiding this comment

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

LGTM

@yiliuTo yiliuTo merged commit 14359a5 into Azure:main Sep 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
azure-spring All azure-spring related issues azure-spring-eventhubs Spring event hubs related issues. Client This issue points to a problem in the data-plane of the library.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make storage account optional
3 participants