AWS SQS Boto3手动将消息发送为死信 [英] AWS SQS Boto3 sending messages to dead letter manually

查看:78
本文介绍了AWS SQS Boto3手动将消息发送为死信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我正在构建一个使用SQS的小型应用程序.我有一个简单的处理程序流程,它确定给定的消息是否被认为已处理,标记为重试(要重新排队)或无法处理(应发送给无效信件).

So I am building a small application that uses SQS. I have a simple handler process that determines if a given message is considered processed, marked for retry (to be re-queued) or is not able to be processed (should be sent to dead letter).

但是,根据文档,将消息真正发送到DL的唯一方法似乎是使用重新驱动策略,该策略在接收到的消息数量已超过#的情况下运行.由于我的应用程序的性质,如果我的进程尚未准备好处理给定的消息,那么我可以进行几次有效的重试,但是有时我可能希望对刚刚收到的消息进行DL处理.AWS/Boto3是否没有提供为DL标记特定消息的方法?

However based on the docs it would appear the only way to truly send a message to DL is by using a redrive policy which operates over # of receives a message has racked up. Because of the nature of my application, I could have several valid retries if my process isn't ready to handle a given message, but there are also times I may want to DL a message I have just received. Does AWS/Boto3 not provide a way to mark a specific message for DL?

我知道我自己可以将消息发送到另一个队列(我认为是我自己的DL),我宁愿使用AWS的内置工具.

I know I can just send the message myself to another queue I consider my own DL, I would just rather use AWS' built in tools for this.

推荐答案

我不认为有任何限制会阻止您自己将消息发送到交易信队列.

I don't believe there is any limitation that would prevent you from sending the message to the deal-letter-queue by yourself.

因此,只需阅读Q中的消息,如果您知道它需要直接转到DLQ,则将其发送到DLQ并将其从常规Q中删除.

So just read the message from the Q, if you know it needs to go to the DLQ directly, send it to the DLQ and remove it from the regular Q.

这篇关于AWS SQS Boto3手动将消息发送为死信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆