简体   繁体   中英

Camel JMS SQS long polling

Currently using camel JMS and have it listening to a queue in SQS. I'm trying to reduce the amount of empty receives. Currently have 3 per minute and would like to reduce to 1.

My bean code looks like:

@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
  • setRequestTimeout of the jmsComponent to 60 secs
  • setReceiveTimeout of the jmsComponent to 60 secs

After doing the above I can still see 3 empty reads per minute.

There is a 20sec wait time limit on the side of SQS, so this is probably not possible.

When the wait time for the ReceiveMessage API action is greater than 0, long polling is in effect. The maximum long polling wait time is 20 seconds.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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