在 SQS 中查找某些消息 [英] Finding certain messages in SQS

查看:31
本文介绍了在 SQS 中查找某些消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道 SQS 不是为此而构建的,但我很好奇是否可以在队列中找到满足某些条件的消息?

I know SQS ain't build for that, but I'm curious is it possible to find messages in a queue that meet some criteria?

我可以循环拉取消息,在消息正文中搜索某种模式(甚至不需要反序列化它们),并过滤我需要的消息.但是,有可能以无限循环结束——当我到达队列末尾时,我阅读的第一条消息将返回队列......

I can pull messages in a loop, search the message bodies for some pattern (without even deserializing them), and filter the messages I needed. But then it is possible to end up with an infinite loop - the first messages I read will be back to the queue by the time when I reach the end of the queue...

扩展消息的可见性是可能的,但我如何确切知道扫描整个队列需要多长时间,以及我应该扩展可见性多长时间?如果我在那里实际上有一万条消息怎么办?

Extending visibility of the messages possible, but how do I know exactly how long it will take to scan the entire queue, and for how long should I extend the visibility? What if I have literally ten thousand messages in there?

这里有什么解决方法吗?我需要扫描队列中的一些消息,然后删除那些......

Is there any workaround here? I need to scan the queue for some messages, and delete those...

推荐答案

简短回答:否.

队列是为诸如任务之类的事情而设计的.一台机器从队列中抓取一个新任务(即消息),执行该任务,然后删除该任务.

Queues are designed for things like tasks. A machine grabs a new task (i.e., message) from the queue, executes the task, then deletes the task.

如果您尝试搜索消息以过滤它们,我不禁怀疑您是否使用了错误的工具来完成这项工作......

If you're trying to search the messages to filter them, I can't help but wonder if you're using the wrong tool for the job…

这篇关于在 SQS 中查找某些消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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