SQS-按ID获取消息 [英] SQS - Get Message By Id

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

问题描述

我是否可以使用Amazon PHP SDK根据消息ID从SQS队列中获取消息?我是否只需要获取队列中的所有消息,然后在服务器上对其进行过滤?

Is it possible for me to get a message from the SQS queue based on the message ID with the Amazon PHP SDK? Do I have to just grab all of the messages on the queue and then filter it on my server?

我的服务器收到一个带有队列消息ID的SNS发起的请求,我不得不从SQS的一系列消息中过滤出该消息.

My server receives a SNS instigated request with a queue message Id and I'm having to filter the message from an array of messages from SQS.

推荐答案

队列的目的是将其用作存储某些处理任务之前的消息的缓冲区.请勿将其与存储服务或数据库服务混淆. Amazon SQS允许进程从队列(缓冲区)中检索消息并根据需要对其进行处理.如果需要,可以使用StandardFIFO队列.

The purpose of a queue is to use it as a buffer to store messages before a certain processing task. This should not be confused with a storage service or a database service. Amazon SQS allows a process to retrieve messages from a queue (buffer) and process them as needed. If needed Standard or FIFO queues can be used.

回答您的问题:SQS不提供通过Message ID进行检索的机制.因此,正如您建议的那样,您可以有单独的工作线程来并行检索所有消息,并查找具有所需ID的消息. (这可能是详尽的)

In answer to your question: SQS does not provide a mechanism to retrieve by Message ID. So as you suggested, you can have separate workers to retrieve all messages in parallel and look for the message with the ID you want. (This can be exhaustive)

由于您的用例类似于存储服务,因此建议写入存储服务并根据名为消息ID"的列从中检索.

Since your use case is similar to that of a storage service, I suggest writing to a storage service and retrieving from it based on a column named "Message ID".

这篇关于SQS-按ID获取消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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