use of com.azure.core.exception.UnexpectedLengthException in project conductor by Netflix.
the class AzureBlobPayloadStorage method upload.
/**
* Uploads the payload to the given azure blob name.
* It is expected that the caller retrieves the blob name
* using {@link #getLocation(Operation, PayloadType, String)} before making this call.
*
* @param path the name of the blob to be uploaded
* @param payload an {@link InputStream} containing the json payload which is to be uploaded
* @param payloadSize the size of the json payload in bytes
*/
@Override
public void upload(String path, InputStream payload, long payloadSize) {
try {
BlockBlobClient blockBlobClient = blobContainerClient.getBlobClient(path).getBlockBlobClient();
BlobHttpHeaders blobHttpHeaders = new BlobHttpHeaders().setContentType(CONTENT_TYPE);
blockBlobClient.uploadWithResponse(payload, payloadSize, blobHttpHeaders, null, null, null, null, null, Context.NONE);
} catch (BlobStorageException | UncheckedIOException | UnexpectedLengthException e) {
String msg = "Error communicating with Azure";
logger.error(msg, e);
throw new ApplicationException(ApplicationException.Code.BACKEND_ERROR, msg, e);
}
}
Aggregations