有关 azure blob 对象更改的通知
我可以通过某种方式订阅有关 Azure blob 对象更改的通知吗?
我的目的是使用 SAS 将文件上传委托给客户端,并在最近(上传完成后)更新数据库。看起来我需要不断检查 blob 的状态,但这是一个非常消耗资源的过程。
Can I somehow subscribe for notifications about Azure's blob object changes?
My purpose is to delegate file uploads to the client using SAS and lately (after upload is complete) update the database. It looks like I need to continuously check blob's state, but it is quite resource consuming process.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Blob 存储无法通知有关对 blob 所做的更改,但正如您所指出的,您可以监视它,请求ETag< /em> 按计划查看是否完成。
话虽这么说,如果实施得当,监视 blob(甚至整个容器)的成本几乎可以忽略不计。每秒对 Blob 存储执行一次 Ping 操作的费用约为每月 2.5 美元。然后,通过使用一些启发式方法,您可能可以将此成本降低到 0.25 美元(平均每 10 秒检查一次)。此时,尝试进一步优化并不是很有趣。
You can't be notified by the Blob Storage about a change made to a blob, but as you point out, you can monitor it, requesting the ETag on a scheduled basis to see if it's done.
That being said, the cost to monitor a blob (or even a whole container) can be close to negligible if correctly implemented. Pinging the Blob Storage once per second costs you roughly $2.5 / month. Then, by using some heuristic you can probably lower this cost to $0.25 (one check per 10s on average). At this point, it's not really interesting to try to optimize more.
现在,您可以使用 Azure 函数
通过指定存储帐户连接创建 Blob 触发器
string 和您的容器/{name}
在输出中,选择其中的位置
您希望通知转到
You can now do this using Azure functions
Create a blob trigger by specifying your storage account connection
string and your container/{name}
In outputs, select the place where
you want your notification to go to
另一个需要考虑的选择是让客户端在上传完成后通知您。
Another option to consider is to have the client notify you when it's done uploading.
我创建了一个用于监视 blob 的文件更改监视器 - 完整详细信息位于 http: //ben.onfabrik.com/posts/monitoring-files-in-azure-blob-storage
I created a file change monitor for monitoring blobs - full details at http://ben.onfabrik.com/posts/monitoring-files-in-azure-blob-storage