Source:
void setupAzureContainer(String accountName, String accountKey) { try { StorageSharedKeyCredential credential = new StorageSharedKeyCredential(accountName, accountKey); HttpClient httpClient; if (config.getUseProxy(systemName)) { LOG.info("HTTP Proxy setup for AzureBlob pipeline"); httpClient = new NettyAsyncHttpClientBuilder() .proxy(new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress(config.getAzureProxyHostname(systemName), config.getAzureProxyPort(systemName)))).build(); } else { httpClient = HttpClient.createDefault(); } String endpoint = String.format(Locale.ROOT, AZURE_URL, accountName); HttpLogOptions httpLogOptions = new HttpLogOptions(); httpLogOptions.setLogLevel(HttpLogDetailLevel.BASIC); BlobServiceAsyncClient storageClient = new BlobServiceClientBuilder() .httpLogOptions(httpLogOptions) .endpoint(endpoint) .credential(credential) .httpClient(httpClient) .buildAsyncClient(); SkuName accountType = storageClient.getAccountInfo().block().getSkuName(); long flushThresholdSize = config.getMaxFlushThresholdSize(systemName); boolean isPremiumAccount = SkuName.PREMIUM_LRS == accountType; if (isPremiumAccount && flushThresholdSize > PREMIUM_MAX_BLOCK_SIZE) { throw new SystemProducerException("Azure storage account with name: " + accountName + " is a premium account and can only handle upto 100MB threshold size. Given flush threshold size is " + flushThresholdSize); } else if (!isPremiumAccount && flushThresholdSize > STANDARD_MAX_BLOCK_SIZE) { throw new SystemProducerException("Azure storage account with name: " + accountName + " is a standard account and can only handle upto 4MB threshold size. Given flush threshold size is " + flushThresholdSize); } containerAsyncClient = storageClient.getBlobContainerAsyncClient(systemName); createContainerIfNotExists(containerAsyncClient); } catch (Exception e) { metrics.updateAzureContainerMetrics(); throw new SystemProducerException("Failed to set up Azure container for SystemName: " + systemName, e); } }

Target:
void setupAzureContainer(String accountName, String accountKey) { try { StorageSharedKeyCredential credential = new StorageSharedKeyCredential(accountName, accountKey); HttpClient httpClient; if (config.getUseProxy(systemName)) { LOG.info("HTTP Proxy setup for AzureBlob pipeline"); httpClient = new NettyAsyncHttpClientBuilder() .proxy(new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress(config.getAzureProxyHostname(systemName), config.getAzureProxyPort(systemName)))).build(); } else { httpClient = HttpClient.createDefault(); } String endpoint = String.format(Locale.ROOT, AZURE_URL, accountName); HttpLogOptions httpLogOptions = new HttpLogOptions(); httpLogOptions.setLogLevel(HttpLogDetailLevel.BASIC); BlobServiceAsyncClient storageClient = new BlobServiceClientBuilder() .httpLogOptions(httpLogOptions) .endpoint(endpoint) .credential(credential) .httpClient(httpClient) .buildAsyncClient(); SkuName accountType = storageClient.getAccountInfo().block().getSkuName(); long flushThresholdSize = config.getMaxFlushThresholdSize(systemName); boolean isPremiumAccount = SkuName.PREMIUM_LRS == accountType; if (isPremiumAccount && flushThresholdSize > PREMIUM_MAX_BLOCK_SIZE) { throw new SystemProducerException("Azure storage account with name: " + accountName + " is a premium account and can only handle upto " + PREMIUM_MAX_BLOCK_SIZE + " threshold size. Given flush threshold size is " + flushThresholdSize); } else if (!isPremiumAccount && flushThresholdSize > STANDARD_MAX_BLOCK_SIZE) { throw new SystemProducerException("Azure storage account with name: " + accountName + " is a standard account and can only handle upto " + STANDARD_MAX_BLOCK_SIZE + " threshold size. Given flush threshold size is " + flushThresholdSize); } containerAsyncClient = storageClient.getBlobContainerAsyncClient(systemName); createContainerIfNotExists(containerAsyncClient); } catch (Exception e) { metrics.updateAzureContainerMetrics(); throw new SystemProducerException("Failed to set up Azure container for SystemName: " + systemName, e); } }