Azure / azure-sdk-for-java

This repository is for active development of the Azure SDK for Java. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/java/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-java.
MIT License
2.29k stars 1.95k forks source link

[FEATURE REQ] Simplify the connection related properties for blob checkpoint store in Spring Cloud Azure Event Hubs libraries #32035

Open yiliuTo opened 1 year ago

yiliuTo commented 1 year ago

Context

When using Storage Blob as the checkpoint store in Spring Cloud Azure Event Hubs libraries, we provide multiple connection related properties to specify the target server entity to connect to. However, in some cases, the usage of those properties may be redundant and cloud be simplified.

The default and simplest usage case is that:

spring:
  cloud:
    azure:
      eventhubs:
        processor:
          checkpoint-store:
            container-name: ...
            account-name: ...
            account-key: ....

However, when there are requests to specify the Storage endpoint, e.g., the server is in Azure China cloud, then developers need to provide properties like:

spring:
  cloud:
    azure:
      eventhubs:
        processor:
          checkpoint-store:
            container-name: ...
            account-name: ...
            endpoint: https://<account-name>.blob.core.chinacloudapi.cn
            account-key: ....

where the endpoint property actually contains the information of account-name but we still require the account-name property to be configured.

Similar cases happen for the property of connection-string, the Storage connection string contains information about the endponit, account name and others. But let's still use the use case that a developer wants to connect to a Storage server in Azure China cloud, then required properties are:

spring:
  cloud:
    azure:
      eventhubs:
        processor:
          checkpoint-store:
            container-name: ...
            account-name: ...
            endpoint: https://<account-name>.blob.core.chinacloudapi.cn
            connection-string: ...

or

spring:
  cloud:
    azure:
      profile:
        cloud-type: azure_china
      eventhubs:
        processor:
          checkpoint-store:
            container-name: ...
            account-name: ...
            connection-string: ...

where multiple properties are required but provide redundant information.

Goal

We should simplify the required properties for the above cases and avoid that developers need to configure multiple properties but provide similar information .

stliu commented 1 year ago

nice catch, I think this is because we didn't aware of the different format that the endpoint support.

Nor we dont' have a clear definition of what value is expected for the checkpoint-store.endpoint

For example BlobServiceClientBuilder has this javadoc

 * The following information must be provided on this builder:
 *
 * <ul>
 * <li>the endpoint through {@code .endpoint()}, in the format of {@code https://{accountName}.blob.core.windows.net}.
 * <li>the credential through {@code .credential()} or {@code .connectionString()} if the container is not publicly
 * accessible.
 * </ul>

BlobClientBuilder has this javadoc

 * <li>the endpoint through {@code .endpoint()}, including the container name and blob name, in the format of
 * {@code https://{accountName}.blob.core.windows.net/{containerName}/{blobName}}.
 * <li>the credential through {@code .credential()} or {@code .connectionString()} if the container is not publicly
 * accessible.
 * </ul>
 */

but our doc

Image