Example usage for com.amazonaws.services.sqs.model ReceiveMessageRequest withAttributeNames

List of usage examples for com.amazonaws.services.sqs.model ReceiveMessageRequest withAttributeNames

Introduction

In this page you can find the example usage for com.amazonaws.services.sqs.model ReceiveMessageRequest withAttributeNames.

Prototype


public ReceiveMessageRequest withAttributeNames(QueueAttributeName... attributeNames) 

Source Link

Document

A list of attributes that need to be returned along with each message.

Usage

From source file:support.SQS.java

License:Open Source License

public List<Message> receiveMessages() throws Exception {
    // Receive messages
    ReceiveMessageRequest receiveMessageRequest = new ReceiveMessageRequest(receive_queue_url);
    receiveMessageRequest.withMessageAttributeNames(message_attribute_name);
    receiveMessageRequest.withAttributeNames(attribute_name);
    receiveMessageRequest.withWaitTimeSeconds(wait_time_seconds);
    receiveMessageRequest.withMaxNumberOfMessages(max_no_messages);
    receiveMessageRequest.withVisibilityTimeout(visibility_timeout);

    List<Message> messages = sqs.receiveMessage(receiveMessageRequest).getMessages();
    return messages;
}