use of com.azure.storage.common.policy.RequestRetryOptions in project ambry by linkedin.
the class StorageClient method createBlobStorageClient.
/**
* Create the {@link BlobServiceClient} object.
* @param {@link CloudConfig} object.
* @param {@link AzureCloudConfig} object.
* @return {@link BlobServiceClient} object.
*/
protected BlobServiceClient createBlobStorageClient() {
validateABSAuthConfigs(azureCloudConfig);
Configuration storageConfiguration = new Configuration();
// Check for network proxy
ProxyOptions proxyOptions = (cloudConfig.vcrProxyHost == null) ? null : new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress(cloudConfig.vcrProxyHost, cloudConfig.vcrProxyPort));
if (proxyOptions != null) {
logger.info("Using proxy: {}:{}", cloudConfig.vcrProxyHost, cloudConfig.vcrProxyPort);
}
HttpClient client = new NettyAsyncHttpClientBuilder().proxy(proxyOptions).build();
// Note: retry decisions are made at CloudBlobStore level. Configure storageClient with no retries.
RequestRetryOptions noRetries = new RequestRetryOptions(RetryPolicyType.FIXED, 1, (Integer) null, null, null, null);
try {
return buildBlobServiceClient(client, storageConfiguration, noRetries, azureCloudConfig);
} catch (MalformedURLException | InterruptedException | ExecutionException ex) {
logger.error("Error building ABS blob service client: {}", ex.getMessage());
throw new IllegalStateException(ex);
}
}
use of com.azure.storage.common.policy.RequestRetryOptions in project ambry by linkedin.
the class StorageClient method createBlobStorageAsyncClient.
/**
* Create the {@link BlobServiceAsyncClient} object.
* @param {@link CloudConfig} object.
* @param {@link AzureCloudConfig} object.
* @return {@link BlobServiceAsyncClient} object.
*/
protected BlobServiceAsyncClient createBlobStorageAsyncClient() {
validateABSAuthConfigs(azureCloudConfig);
Configuration storageConfiguration = new Configuration();
// Check for network proxy
ProxyOptions proxyOptions = (cloudConfig.vcrProxyHost == null) ? null : new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress(cloudConfig.vcrProxyHost, cloudConfig.vcrProxyPort));
if (proxyOptions != null) {
logger.info("Using proxy: {}:{}", cloudConfig.vcrProxyHost, cloudConfig.vcrProxyPort);
}
HttpClient client = new NettyAsyncHttpClientBuilder().proxy(proxyOptions).build();
// Note: retry decisions are made at CloudBlobStore level. Configure storageClient with no retries.
RequestRetryOptions noRetries = new RequestRetryOptions(RetryPolicyType.FIXED, 1, (Integer) null, null, null, null);
try {
return buildBlobServiceAsyncClient(client, storageConfiguration, noRetries, azureCloudConfig);
} catch (MalformedURLException | InterruptedException | ExecutionException ex) {
logger.error("Error building ABS blob service client: {}", ex.getMessage());
throw new IllegalStateException(ex);
}
}
Aggregations