简体   繁体   English

Spring Cloud SQS 轮询

[英]Spring Cloud SQS polling

I'm using Spring Cloud to consume an AWS SQS.我正在使用 Spring Cloud 来使用 AWS SQS。 I would like to control the number of polls by setting up an interval between these requests, but I can't find any option to do this.我想通过设置这些请求之间的间隔来控制轮询次数,但我找不到任何选项来执行此操作。

I'm thinking that using the long polling it's not necessary to control the poll interval.我认为使用长轮询没有必要控制轮询间隔。 It is that true?这是真的吗?

Thank you!谢谢!

是的,如果您使用长轮询,您将保持连接打开,直到您收到事件,并且您将在它发布时接近它。

You can use WaitTimeSeconds to achieve what you want.您可以使用 WaitTimeSeconds 来实现您想要的。 Here is AWS documentation - http://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_ReceiveMessage.html这是 AWS 文档 - http://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_ReceiveMessage.html

The duration (in seconds) for which the call waits for a message to arrive in the queue before returning.调用在返回之前等待消息到达队列的持续时间(以秒为单位)。 If a message is available, the call returns sooner than WaitTimeSeconds.如果消息可用,则调用会早于 WaitTimeSeconds 返回。

This one is an optional parameter, so if you don't pass it then it is 0 seconds这是一个可选参数,所以如果你不传递它那么它是0秒

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM