1

Need: to poll/listen 10 messages at a time(Specific count not based on polling time) Existing code base using spring cloud aws messaging polls based on time by default. now required to poll based on the counts of messages.

Looking for a annotation based configuration similar approach to the below code

@SqsListener(value = "xxx-sqs",deletionPolicy = ON_SUCCESS)
public void auditProcessor(String json) throws IOException {
    log.info("*********** Inside Listner***********");
    log.info("JSON Data "+json);
}

Any help on this would be appreciated.

rolling stone
  • 543
  • 1
  • 8
  • 26

1 Answers1

0

The amount of messages requested from SQS can be configured in SimpleMessageListenerContainerFactory.

That being said SQS works in a way that even if you ask for 10 messages you have no guarantee you will get 10 even if there are more messages in the queue. You can only be sure that you will not get more than 10.

Maciej Walkowiak
  • 12,372
  • 59
  • 63