How do you delete a single Blob file with the Azure SDK v12 for Java? This is what i tried so far. But it doesn't work.
Btw the sample code is Kotlin:
val blobServiceClient: BlobServiceAsyncClient by lazy {
BlobServiceClientBuilder()
.endpoint(blobProperties.endpoint)
.sasToken(blobProperties.sasToken)
.buildAsyncClient()
}
val containerClient = blobServiceClient.getBlobContainerAsyncClient(blobProperties.containerName)
val blobName = "test.jpg"
val imageClient = containerClient.getBlobAsyncClient(blobName).blockBlobAsyncClient
val deleteImage = imageClient.delete()
println(deleteImage)
We are using the library "azure-storage-blob-12.4.0.jar"
In the end a simple block()
was what worked for me which causes the MonoFlatMap to block indefinitely until a next signal is received.
containerClient.getBlobAsyncClient(blobName).delete().block()
If you want to read further information about block() you can find it here: https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html#block--