AWS SQS-使用节点JS在队列中检索所有消息
我有每5分钟连续运行的lambda并处理SQS消息。在我的队列中,有超过500的消息。我需要检索所有数据并根据ID相互映射。默认情况下,我只能检索10条消息。是否有可能检索10多个消息?
I have cronjob attached lambda running for every 5 minutes and processing SQS messages. In my queue have messages of more than 500. I need to retrieve all data and map each other based on ID. By default, I can able to retrieve only 10 messages. Is there any possibility to retrieve more than 10 messages?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如您在,但是您可以继续前进。只要继续增加,直到剩下。
为了扩展,答案取决于您使用的SDK,但API是相同的。您只需使用
之类的东西,而
循环中的条件检查返回的消息列表的长度。如果该列表为空,您将离开循环并完成。如果不是空的,则重复请求。Not in a single request, as you can see in the documentation, but you can just keep going. Just keep getting more, until there are none left.
To expand, the answer depends on which sdk you're using, but the api is the same. You just use something like a
while
loop where the condition checks the length of the list of messages returned. If that list is empty you leave the loop and finish. If it isn't empty you repeat the request.