class PollRequestProcessor implements SQSRequestProcessor {

    @Override
    public SQSQueueResult processRequest(SQSRequestContext sqsRequestContext)
    {
        AmazonSQS amazonSQS = sqsRequestContext.getSqsClient();

        SQSQueueResult result = new SQSQueueResult();
        ReceiveMessageRequest receiveMessageRequest = new ReceiveMessageRequest()
                .withQueueUrl(sqsRequestContext.getQueueURL())
                .withMaxNumberOfMessages(getMaxMessages(sqsRequestContext));
        receiveMessageRequest.setWaitTimeSeconds(waitTimeSeconds);
        ReceiveMessageResult receiveMessageResult = amazonSQS.receiveMessage(receiveMessageRequest);
        if (receiveMessageResult.getMessages().size() >= 1)
        {
            List<String> messageBodies = new LinkedList<>();
            for (Message receivedMessage : receiveMessageResult.getMessages())
            {
                try
                {
                    DeleteMessageRequest deleteMessageRequest = new DeleteMessageRequest()
                        .withQueueUrl(sqsRequestContext.getQueueURL())
                        .withReceiptHandle(receivedMessage.getReceiptHandle());
                    // NOTE/TODO: the response object from this request is useless
                    amazonSQS.deleteMessage(deleteMessageRequest);
                    messageBodies.add(receivedMessage.getBody());
                }
                catch(Exception e)
                {
                    // continue on, item not removed from the queue nor added to the results
                }
            }
            result
                .setSuccessful(true)
                .setData(messageBodies);
        }
        else
        {
            // no result from sqs is valid due to timing
            result.setSuccessful(true);
            result.setData(null);
        }
        return result;
    }

}