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

查看:74
本文介绍了在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天全站免登陆