Retrieve multiple messages from SQS

后端 未结 8 1951
逝去的感伤
逝去的感伤 2020-12-10 00:55

I have multiple messages in SQS. The following code always returns only one, even if there are dozens visible (not in flight). setMaxNumberOfMessages I th

8条回答
  •  粉色の甜心
    2020-12-10 01:17

    receiveMessageRequest.withMaxNumberOfMessages(10);

    Just to be clear, the more practical use of this would be to add to your constructor like this:

    ReceiveMessageRequest receiveMessageRequest = new ReceiveMessageRequest(queueUrl).withMaxNumberOfMessages(10);
    

    Otherwise, you might as well just do:

    receiveMessageRequest.setMaxNumberOfMessages(10);
    

    That being said, changing this won't help the original problem.

提交回复
热议问题