shared/queue/src/main/java/net/devfront/aws/queue/SqsQueueService.java
/**
     * Retrieves one or more messages (up to maxNumberOfMessages) from the specified queue.
     *
     * @param maxNumberOfMessages The maximum number of messages to return.
     * @return a list of messages.
     */
Retrieves one or more messages (up to maxNumberOfMessages) from the specified queue.
@param maxNumberOfMessages The maximum number of messages to return.
@return a list of messages.
Retrieves one or more messages ( up to maxNumberOfMessages ) from the specified queue . @param maxNumberOfMessages The maximum number of messages to return . @return a list of messages .
public List<Message> receiveMessage(int maxNumberOfMessages) {
        List<Message> messages = new ArrayList<>();
        String queueUrl = getUrl();
        if (queueUrl == null || queueUrl.isEmpty()) {
            return messages;
        }
        int maxForBatch = maxNumberOfMessages > MAX_MESSAGES ? MAX_MESSAGES : maxNumberOfMessages;
        try {
            ReceiveMessageRequest receiveMessageRequest = new ReceiveMessageRequest(queueUrl)
                .withMaxNumberOfMessages(maxForBatch);
            messages = sqsClient.receiveMessage(receiveMessageRequest).getMessages();
        } catch (AmazonServiceException ase) {
            logException(ase);
        } catch (AmazonClientException ace) {
            logger.error("Could not reach SQS. {}", ace.toString());
        }
        return messages;
    }
public List < Message > receiveMessage ( int maxNumberOfMessages ) { List < Message > messages = new ArrayList < > ( ) ; String queueUrl = getUrl ( ) ; if ( queueUrl == null || queueUrl . isEmpty ( ) ) { return messages ; } int maxForBatch = maxNumberOfMessages > MAX_MESSAGES ? MAX_MESSAGES : maxNumberOfMessages ; try { ReceiveMessageRequest receiveMessageRequest = new ReceiveMessageRequest ( queueUrl ) . withMaxNumberOfMessages ( maxForBatch ) ; messages = sqsClient . receiveMessage ( receiveMessageRequest ) . getMessages ( ) ; } catch ( AmazonServiceException ase ) { logException ( ase ) ; } catch ( AmazonClientException ace ) { logger . error ( "Could not reach SQS. {}" , ace . toString ( ) ) ; } return messages ; }
Retrieves one or more messages (up to maxNumberOfMessages) from the specified queue.
Retrieves one or more messages ( up to maxNumberOfMessages ) from the specified queue .