gpt4 book ai didi

amazon-web-services - 如何通知用户 lambda 函数已完成?

转载 作者:行者123 更新时间:2023-12-04 12:46:41 25 4
gpt4 key购买 nike

AWS lambda 使运行代码以响应事件成为可能,例如将文件上传到 s3。但是,lambda 回调会通知事件调用者,而不是发起事件的用户。

考虑以下场景:

  • 用户上传文件到 s3
  • 该文件已处理
  • 用户收到处理完成的通知

  • 您将如何使用 AWS lambda 做到这一点?

    最佳答案

    上传文件时,将电子邮件地址或其他标识符添加到对象中作为Object User-Defined Metadata .

    When uploading an object, you can also assign metadata to the object. You provide this optional information as a name-value (key-value) pair when you send a PUT or POST request to create the object. When uploading objects using the REST API the optional user-defined metadata names must begin with "x-amz-meta-" to distinguish them from other HTTP headers. When you retrieve the object using the REST API, this prefix is returned. When uploading objects using the SOAP API, the prefix is not required. When you retrieve the object using the SOAP API, the prefix is removed, regardless of which API you used to upload the object.



    当 Lambda 函数完成文件处理时,它可以读取相同的元数据,并向用户发送适当的通知。

    关于amazon-web-services - 如何通知用户 lambda 函数已完成?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37925916/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com