List of usage examples for com.amazonaws.services.sqs.model SendMessageRequest getRequestClientOptions
public RequestClientOptions getRequestClientOptions()
From source file:com.amazon.sqs.javamessaging.AmazonSQSExtendedClient.java
License:Open Source License
/** * <p>//from ww w . j a v a2 s .co m * Delivers a message to the specified queue and uploads the message payload * to Amazon S3 if necessary. * </p> * <p> * <b>IMPORTANT:</b> The following list shows the characters (in Unicode) * allowed in your message, according to the W3C XML specification. For more * information, go to http://www.w3.org/TR/REC-xml/#charsets If you send any * characters not included in the list, your request will be rejected. #x9 | * #xA | #xD | [#x20 to #xD7FF] | [#xE000 to #xFFFD] | [#x10000 to #x10FFFF] * </p> * * <b>IMPORTANT:</b> The input object may be modified by the method. </p> * * @param sendMessageRequest * Container for the necessary parameters to execute the * SendMessage service method on AmazonSQS. * * @return The response from the SendMessage service method, as returned by * AmazonSQS. * * @throws InvalidMessageContentsException * @throws UnsupportedOperationException * * @throws AmazonClientException * If any internal errors are encountered inside the client * while attempting to make the request or handle the response. * For example if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonSQS indicating * either a problem with the data in the request, or a server * side issue. */ public SendMessageResult sendMessage(SendMessageRequest sendMessageRequest) { if (sendMessageRequest == null) { String errorMessage = "sendMessageRequest cannot be null."; LOG.error(errorMessage); throw new AmazonClientException(errorMessage); } sendMessageRequest.getRequestClientOptions().appendUserAgent(SQSExtendedClientConstants.USER_AGENT_HEADER); if (!clientConfiguration.isLargePayloadSupportEnabled()) { return super.sendMessage(sendMessageRequest); } if (sendMessageRequest.getMessageBody() == null || "".equals(sendMessageRequest.getMessageBody())) { String errorMessage = "messageBody cannot be null or empty."; LOG.error(errorMessage); throw new AmazonClientException(errorMessage); } if (clientConfiguration.isAlwaysThroughS3() || isLarge(sendMessageRequest)) { sendMessageRequest = storeMessageInS3(sendMessageRequest); } return super.sendMessage(sendMessageRequest); }