[英]How to delete a single Blob file with Azure SDK for Java v12?
How do you delete a single Blob file with the Azure SDK v12 for Java?如何使用 Azure SDK v12 for Java 删除单个 Blob 文件? This is what i tried so far.这是我到目前为止所尝试的。 But it doesn't work.但它不起作用。
Btw the sample code is Kotlin:顺便说一句,示例代码是 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"我们正在使用库“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.最后,一个简单的block()
对我有用,它导致 MonoFlatMap 无限期地阻塞,直到收到下一个信号。
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--如果您想阅读有关 block() 的更多信息,可以在此处找到: https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html#block--
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.