简体   繁体   English

Camel JMS SQS 长轮询

[英]Camel JMS SQS long polling

Currently using camel JMS and have it listening to a queue in SQS.目前使用骆驼 JMS 并让它监听 SQS 中的队列。 I'm trying to reduce the amount of empty receives.我正在尝试减少空接收的数量。 Currently have 3 per minute and would like to reduce to 1.目前每分钟有 3 个,希望减少到 1 个。

My bean code looks like:我的 bean 代码如下所示:

@Bean(name = "jms")
@ConditionalOnClass(JmsComponent.class)
public JmsComponent jmsComponent(SQSConnectionFactory sqsConnectionFactory) {
    JmsComponent jmsComponent = new JmsComponent();
    jmsComponent.setConnectionFactory(sqsConnectionFactory);
    return jmsComponent;
}

I have tried the following:我尝试了以下方法:

  • set receive message wait time to 20 secs in the queue将队列中的接收消息等待时间设置为 20 秒
  • setRequestTimeout of the jmsComponent to 60 secs jmsComponent 的 setRequestTimeout 为 60 秒
  • setReceiveTimeout of the jmsComponent to 60 secs jmsComponent 的 setReceiveTimeout 为 60 秒

After doing the above I can still see 3 empty reads per minute.完成上述操作后,我仍然可以看到每分钟 3 次空读取。

There is a 20sec wait time limit on the side of SQS, so this is probably not possible. SQS 方面有 20 秒的等待时间限制,所以这可能是不可能的。

When the wait time for the ReceiveMessage API action is greater than 0, long polling is in effect.当 ReceiveMessage API 操作的等待时间大于 0 时,长轮询生效。 The maximum long polling wait time is 20 seconds.最长轮询等待时间为 20 秒。

https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/working-with-messages.html#setting-up-long-polling https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/working-with-messages.html#setting-up-long-polling

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

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