When is Azure (Java) BlobClient.uploadWithResponse ready with uploading?

Viewed 367

I want to upload an image to Azure and when it is properly uploaded I want to delete the original local image. To do so I need to know when the upload is succesful/ finished.

The docs of BlobClient.uploadWithResponse mention it returns Response<BlockBlobItem>. Can I use this response to trigger a subsequent action/ method? And if yes, how?

1 Answers

Considering Azure Storage is strongly consistent, you will get a successful response only when the blob is created. You can make use of the status code (201 - Created) to determine if the blob is created successfully or not.

To check the status code you can use getStatusCode() in Response object.

Related