gpt4 book ai didi

java - 是否可以在处理消息之前将其从 SQS AWS 服务中出列?

转载 作者:行者123 更新时间:2023-12-02 04:39:39 27 4
gpt4 key购买 nike

我刚刚开始使用AWS的SQS服务。好吧,我确实知道我们可以使用收到消息时收到的 ReceiptHandle 来删除进程,但我想在消息位于队列中时将其删除或将其移至死信队列。是否有可能,因为文档中没有提及它?如果是,请给我提供提示或代码或任何链接。谢谢

就像有一个使用 ReceiptHandle 删除消息的方法。

for (Message m : messages) {
sqs.deleteMessage(queueUrl, m.getReceiptHandle());
}

最佳答案

经过更多研究,我在 AWS SQS 开发人员指南中发现了这一点。

Every time you receive a message from a queue, you receive a receipt handle for that message. This handle is associated with the action of receiving the message, not with the message itself. To delete the message or to change the message visibility, you must provide the receipt handle (not the message ID). Thus, you must always receive a message before you can delete it (you can't put a message into the queue and then recall it). The maximum length of a receipt handle is 1,024 characters.`

关于java - 是否可以在处理消息之前将其从 SQS AWS 服务中出列?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56525906/

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