Example usage for com.amazonaws.services.sqs AmazonSQSClient sendMessage

List of usage examples for com.amazonaws.services.sqs AmazonSQSClient sendMessage

Introduction

In this page you can find the example usage for com.amazonaws.services.sqs AmazonSQSClient sendMessage.

Prototype

@Override
public SendMessageResult sendMessage(SendMessageRequest request) 

Source Link

Document

Delivers a message to the specified queue.

Usage

From source file:awslabs.lab31.SolutionCode.java

License:Open Source License

@Override
public void postToQueue(AmazonSQSClient sqsClient, String queueUrl, String messageText) {
    // TODO: Construct a SendMessageRequest object using the provided queue URL and message.
    SendMessageRequest sendMessageRequest = new SendMessageRequest().withMessageBody(messageText)
            .withQueueUrl(queueUrl);/*from  ww w  .ja  v a2  s. c o m*/

    // TODO: Submit the request using the sendMessage method of the sqsClient object.
    sqsClient.sendMessage(sendMessageRequest);
}

From source file:awslabs.lab31.StudentCode.java

License:Open Source License

/**
 * Post a message to the specified queue. Hint: Use the sendMessage() method of the client object.
 * //from w  w  w  .  j a v  a 2  s. c  o m
 * @param sqsClient The SQS Client object.
 * @param queueUrl The URL for the queue to place the message in.
 * @param messageText The body of the message to place in the queue.
 */
@Override
public void postToQueue(AmazonSQSClient sqsClient, String queueUrl, String messageText) {
    SendMessageRequest request = new SendMessageRequest(queueUrl, messageText);

    sqsClient.sendMessage(request);
}