List of usage examples for com.amazonaws.services.sqs.model QueueAttributeName RedrivePolicy
QueueAttributeName RedrivePolicy
To view the source code for com.amazonaws.services.sqs.model QueueAttributeName RedrivePolicy.
Click Source Link
From source file:org.springframework.cloud.aws.messaging.listener.AbstractMessageListenerContainer.java
License:Apache License
private QueueAttributes queueAttributes(String queue, SqsMessageDeletionPolicy deletionPolicy) { String destinationUrl;// w w w . j a v a2 s .c om try { destinationUrl = getDestinationResolver().resolveDestination(queue); } catch (DestinationResolutionException e) { getLogger().warn(String.format("The queue with name '%s' does not exist.", queue), e); return null; } ReceiveMessageRequest receiveMessageRequest = new ReceiveMessageRequest(destinationUrl) .withAttributeNames(RECEIVING_ATTRIBUTES).withMessageAttributeNames(RECEIVING_MESSAGE_ATTRIBUTES); if (getMaxNumberOfMessages() != null) { receiveMessageRequest.withMaxNumberOfMessages(getMaxNumberOfMessages()); } else { receiveMessageRequest.withMaxNumberOfMessages(DEFAULT_MAX_NUMBER_OF_MESSAGES); } if (getVisibilityTimeout() != null) { receiveMessageRequest.withVisibilityTimeout(getVisibilityTimeout()); } if (getWaitTimeOut() != null) { receiveMessageRequest.setWaitTimeSeconds(getWaitTimeOut()); } GetQueueAttributesResult queueAttributes = getAmazonSqs().getQueueAttributes( new GetQueueAttributesRequest(destinationUrl).withAttributeNames(QueueAttributeName.RedrivePolicy)); boolean hasRedrivePolicy = queueAttributes.getAttributes() .containsKey(QueueAttributeName.RedrivePolicy.toString()); return new QueueAttributes(receiveMessageRequest, hasRedrivePolicy, deletionPolicy); }