Search in sources :

Example 1 with AzureBlobClientBuilder

use of org.apache.samza.system.azureblob.AzureBlobClientBuilder in project samza by apache.

the class AzureBlobSystemProducer method setupAzureContainer.

@VisibleForTesting
void setupAzureContainer() {
    try {
        BlobServiceAsyncClient storageClient = new AzureBlobClientBuilder(systemName, AZURE_URL, config).getBlobServiceAsyncClient();
        validateFlushThresholdSizeSupported(storageClient);
        containerAsyncClient = storageClient.getBlobContainerAsyncClient(systemName);
        // Only way to check if container exists or not is by creating it and look for failure/success.
        createContainerIfNotExists(containerAsyncClient);
    } catch (Exception e) {
        metrics.updateAzureContainerMetrics();
        throw new SystemProducerException("Failed to set up Azure container for SystemName: " + systemName, e);
    }
}
Also used : AzureBlobClientBuilder(org.apache.samza.system.azureblob.AzureBlobClientBuilder) BlobServiceAsyncClient(com.azure.storage.blob.BlobServiceAsyncClient) BlobStorageException(com.azure.storage.blob.models.BlobStorageException) SystemProducerException(org.apache.samza.system.SystemProducerException) IOException(java.io.IOException) SystemProducerException(org.apache.samza.system.SystemProducerException) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Aggregations

BlobServiceAsyncClient (com.azure.storage.blob.BlobServiceAsyncClient)1 BlobStorageException (com.azure.storage.blob.models.BlobStorageException)1 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 IOException (java.io.IOException)1 SystemProducerException (org.apache.samza.system.SystemProducerException)1 AzureBlobClientBuilder (org.apache.samza.system.azureblob.AzureBlobClientBuilder)1