com.amazonaws.services.sqs.model.SendMessageBatchRequest Java Examples
The following examples show how to use
com.amazonaws.services.sqs.model.SendMessageBatchRequest.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SnsServiceImpl.java From Serverless-Programming-Cookbook with MIT License | 6 votes |
@Override public final Boolean processEvent(final SNSEvent event, final String outputQueueURL, final LambdaLogger logger) { try { logger.log("Number of records in event: " + event.getRecords().size()); Collection<SendMessageBatchRequestEntry> entries = new ArrayList<>(); int idVal = 1; for (SNSRecord r : event.getRecords()) { logger.log("Adding message: " + r.getSNS().getMessage()); entries.add(new SendMessageBatchRequestEntry("id_" + idVal, r.getSNS().getMessage())); idVal++; } final SendMessageBatchRequest sendBatchRequest = new SendMessageBatchRequest() .withQueueUrl(outputQueueURL) .withEntries(entries); this.sqsClient.sendMessageBatch(sendBatchRequest); } catch (Exception e) { final String errorMessage = "Error occurred: " + e.getMessage(); logger.log(errorMessage); return false; } return true; }
Example #2
Source File: TestPutSQS.java From nifi with Apache License 2.0 | 6 votes |
@Test public void testPutException() throws IOException { runner.setProperty(PutSQS.QUEUE_URL, "https://sqs.us-west-2.amazonaws.com/123456789012/test-queue-000000000"); final Map<String, String> attrs = new HashMap<>(); attrs.put("filename", "1.txt"); runner.enqueue("TestMessageBody", attrs); Mockito.when(mockSQSClient.sendMessageBatch(Mockito.any(SendMessageBatchRequest.class))).thenThrow(new AmazonSQSException("TestFail")); runner.run(1); ArgumentCaptor<SendMessageBatchRequest> captureRequest = ArgumentCaptor.forClass(SendMessageBatchRequest.class); Mockito.verify(mockSQSClient, Mockito.times(1)).sendMessageBatch(captureRequest.capture()); SendMessageBatchRequest request = captureRequest.getValue(); assertEquals("https://sqs.us-west-2.amazonaws.com/123456789012/test-queue-000000000", request.getQueueUrl()); assertEquals("TestMessageBody", request.getEntries().get(0).getMessageBody()); runner.assertAllFlowFilesTransferred(PutSQS.REL_FAILURE, 1); }
Example #3
Source File: TestPutSQS.java From nifi with Apache License 2.0 | 6 votes |
@Test public void testSimplePut() throws IOException { runner.setProperty(PutSQS.QUEUE_URL, "https://sqs.us-west-2.amazonaws.com/123456789012/test-queue-000000000"); Assert.assertTrue(runner.setProperty("x-custom-prop", "hello").isValid()); final Map<String, String> attrs = new HashMap<>(); attrs.put("filename", "1.txt"); runner.enqueue("TestMessageBody", attrs); SendMessageBatchResult batchResult = new SendMessageBatchResult(); Mockito.when(mockSQSClient.sendMessageBatch(Mockito.any(SendMessageBatchRequest.class))).thenReturn(batchResult); runner.run(1); ArgumentCaptor<SendMessageBatchRequest> captureRequest = ArgumentCaptor.forClass(SendMessageBatchRequest.class); Mockito.verify(mockSQSClient, Mockito.times(1)).sendMessageBatch(captureRequest.capture()); SendMessageBatchRequest request = captureRequest.getValue(); assertEquals("https://sqs.us-west-2.amazonaws.com/123456789012/test-queue-000000000", request.getQueueUrl()); assertEquals("hello", request.getEntries().get(0).getMessageAttributes().get("x-custom-prop").getStringValue()); assertEquals("TestMessageBody", request.getEntries().get(0).getMessageBody()); runner.assertAllFlowFilesTransferred(PutSQS.REL_SUCCESS, 1); }
Example #4
Source File: SendMessageTracingRequestHandler.java From zipkin-aws with Apache License 2.0 | 6 votes |
private void handleSendMessageBatchRequest(SendMessageBatchRequest request) { TraceContext maybeParent = currentTraceContext.get(); Span span; if (maybeParent == null) { span = tracer.nextSpan(); } else { // If we have a span in scope assume headers were cleared before span = tracer.newChild(maybeParent); } span.name("publish-batch").remoteServiceName("amazon-sqs").start(); try (SpanInScope scope = tracer.withSpanInScope(span)) { for (SendMessageBatchRequestEntry entry : request.getEntries()) { injectPerMessage(request.getQueueUrl(), entry.getMessageAttributes()); } } finally { span.finish(); } }
Example #5
Source File: MessageListenerContainerAwsTest.java From spring-cloud-aws with Apache License 2.0 | 5 votes |
@Override public void run() { List<SendMessageBatchRequestEntry> messages = new ArrayList<>(); for (int i = 0; i < BATCH_MESSAGE_SIZE; i++) { messages.add(new SendMessageBatchRequestEntry(Integer.toString(i), new StringBuilder().append("message_").append(i).toString())); } this.amazonSqs.sendMessageBatch( new SendMessageBatchRequest(this.queueUrl, messages)); this.countDownLatch.countDown(); }
Example #6
Source File: SqsServiceImpl.java From Serverless-Programming-Cookbook with MIT License | 5 votes |
@Override public final Boolean processEvent(final SQSEvent event, final String outputQueueURL, final LambdaLogger logger) { try { logger.log("Number of messages in event: " + event.getRecords().size()); logger.log("Output Queue URL: " + outputQueueURL); Collection<SendMessageBatchRequestEntry> entries = new ArrayList<>(); int idVal = 1; for (SQSMessage m : event.getRecords()) { logger.log("Adding message: " + m.getBody()); entries.add(new SendMessageBatchRequestEntry("id_" + idVal, m.getBody())); idVal++; } final SendMessageBatchRequest sendBatchRequest = new SendMessageBatchRequest() .withQueueUrl(outputQueueURL) .withEntries(entries); this.sqsClient.sendMessageBatch(sendBatchRequest); } catch (Exception e) { final String errorMessage = "Error occurred: " + e.getMessage(); logger.log(errorMessage); return false; } return true; }
Example #7
Source File: AmazonSQSIdleQueueDeletingClient.java From amazon-sqs-java-temporary-queues-client with Apache License 2.0 | 5 votes |
@Override public SendMessageBatchResult sendMessageBatch(SendMessageBatchRequest request) { try { heartbeatToQueueIfNecessary(request.getQueueUrl()); return super.sendMessageBatch(request); } catch (QueueDoesNotExistException e) { request.setQueueUrl(recreateQueue(request.getQueueUrl())); return super.sendMessageBatch(request); } }
Example #8
Source File: SQSResourcesIntegrationTest.java From aws-sdk-java-resources with Apache License 2.0 | 5 votes |
/** * Tests sending messages using batch operation and retrieve them. Also * tests setting the queue attributes and retrieving them. */ @Test @Ignore public void testQueueSubResourceAndAttributes() throws InterruptedException { /** * Trying to get the message which is deleted. Here there is no service * call made, a new sub resource is created with the given handle. So, * this wont be returning null. */ Message message = queue.getMessage("invalid-recepient-handle"); assertNotNull(message); try { message.getAttributes(); fail("An unsupported operation exception must be thrown as load operation is no supported on message attribute"); } catch (UnsupportedOperationException use) { } SendMessageBatchResult sendMessageBatchResult = queue .sendMessages(new SendMessageBatchRequest() .withEntries(new SendMessageBatchRequestEntry("msg1", TEST_MESSAGE))); SendMessageBatchResultEntry sendMessageBatchResultEntry = sendMessageBatchResult .getSuccessful().get(0); List<Message> messages = waitForMessagesFromQueue(null); assertNotNull(messages); assertEquals(1, messages.size()); message = messages.get(0); assertMessage(TEST_MESSAGE, sendMessageBatchResultEntry.getMessageId(), sendMessageBatchResultEntry.getMD5OfMessageBody(), message); queue.setAttributes(ImmutableMapParameter.of("MaximumMessageSize", "2048")); assertTrue(queue.getAttributes().containsKey("MaximumMessageSize")); }
Example #9
Source File: QueueImpl.java From aws-sdk-java-resources with Apache License 2.0 | 5 votes |
@Override public SendMessageBatchResult sendMessages( List<SendMessageBatchRequestEntry> entries, ResultCapture<SendMessageBatchResult> extractor) { SendMessageBatchRequest request = new SendMessageBatchRequest() .withEntries(entries); return sendMessages(request, extractor); }
Example #10
Source File: QueueImpl.java From aws-sdk-java-resources with Apache License 2.0 | 5 votes |
@Override public SendMessageBatchResult sendMessages( ResultCapture<SendMessageBatchResult> extractor) { SendMessageBatchRequest request = new SendMessageBatchRequest(); return sendMessages(request, extractor); }
Example #11
Source File: QueueImpl.java From aws-sdk-java-resources with Apache License 2.0 | 5 votes |
@Override public SendMessageBatchResult sendMessages(SendMessageBatchRequest request, ResultCapture<SendMessageBatchResult> extractor) { ActionResult result = resource.performAction("SendMessages", request, extractor); if (result == null) return null; return (SendMessageBatchResult) result.getData(); }
Example #12
Source File: SendReceiveMessages.java From aws-doc-sdk-examples with Apache License 2.0 | 5 votes |
public static void main(String[] args) { final AmazonSQS sqs = AmazonSQSClientBuilder.defaultClient(); try { CreateQueueResult create_result = sqs.createQueue(QUEUE_NAME); } catch (AmazonSQSException e) { if (!e.getErrorCode().equals("QueueAlreadyExists")) { throw e; } } String queueUrl = sqs.getQueueUrl(QUEUE_NAME).getQueueUrl(); SendMessageRequest send_msg_request = new SendMessageRequest() .withQueueUrl(queueUrl) .withMessageBody("hello world") .withDelaySeconds(5); sqs.sendMessage(send_msg_request); // Send multiple messages to the queue SendMessageBatchRequest send_batch_request = new SendMessageBatchRequest() .withQueueUrl(queueUrl) .withEntries( new SendMessageBatchRequestEntry( "msg_1", "Hello from message 1"), new SendMessageBatchRequestEntry( "msg_2", "Hello from message 2") .withDelaySeconds(10)); sqs.sendMessageBatch(send_batch_request); // receive messages from the queue List<Message> messages = sqs.receiveMessage(queueUrl).getMessages(); // delete messages from the queue for (Message m : messages) { sqs.deleteMessage(queueUrl, m.getReceiptHandle()); } }
Example #13
Source File: SendMessageTracingRequestHandlerTest.java From zipkin-aws with Apache License 2.0 | 5 votes |
@Test public void handleSendMessageBatchRequest() { SendMessageBatchRequest request = new SendMessageBatchRequest("queueUrl"); SendMessageBatchRequestEntry entry1 = new SendMessageBatchRequestEntry("id1", "test message body 1"); SendMessageBatchRequestEntry entry2 = new SendMessageBatchRequestEntry("id2", "test message body 2"); request.withEntries(entry1, entry2); handler.beforeExecution(request); assertThat(spans).hasSize(3); MutableSpan localParent = spans.spans().stream().filter(s -> s.parentId() == null).findFirst().get(); // Verify propagation for (SendMessageBatchRequestEntry entry : request.getEntries()) { verifyInjectedTraceContext(entry.getMessageAttributes(), localParent); } // Verify Span assertThat(localParent.name()).isEqualTo("publish-batch"); List<MutableSpan> messageSpans = spans.spans().stream().filter(s -> s != localParent).collect(Collectors.toList()); for (MutableSpan span : messageSpans) { verifyReportedPublishSpan(span); } }
Example #14
Source File: SendMessageTracingRequestHandler.java From zipkin-aws with Apache License 2.0 | 5 votes |
@Override public AmazonWebServiceRequest beforeExecution(AmazonWebServiceRequest request) { if (request instanceof SendMessageRequest) { handleSendMessageRequest((SendMessageRequest) request); } else if (request instanceof SendMessageBatchRequest) { handleSendMessageBatchRequest((SendMessageBatchRequest) request); } return request; }
Example #15
Source File: SQSObservableQueue.java From conductor with Apache License 2.0 | 5 votes |
private void publishMessages(List<Message> messages) { logger.debug("Sending {} messages to the SQS queue: {}", messages.size(), queueName); SendMessageBatchRequest batch = new SendMessageBatchRequest(queueURL); messages.forEach(msg -> { SendMessageBatchRequestEntry sendr = new SendMessageBatchRequestEntry(msg.getId(), msg.getPayload()); batch.getEntries().add(sendr); }); logger.debug("sending {} messages in batch", batch.getEntries().size()); SendMessageBatchResult result = client.sendMessageBatch(batch); logger.debug("send result: {} for SQS queue: {}", result.getFailed().toString(), queueName); }
Example #16
Source File: AbstractAmazonSQSClientWrapperTest.java From amazon-sqs-java-temporary-queues-client with Apache License 2.0 | 4 votes |
@Test public void sendMessageBatch() { assertWrappedMethod(AmazonSQS::sendMessageBatch, new SendMessageBatchRequest()); }
Example #17
Source File: QueueImpl.java From aws-sdk-java-resources with Apache License 2.0 | 4 votes |
@Override public SendMessageBatchResult sendMessages(SendMessageBatchRequest request) { return sendMessages(request, null); }
Example #18
Source File: AbstractAmazonSQSClientWrapper.java From amazon-sqs-java-temporary-queues-client with Apache License 2.0 | 4 votes |
@Override public SendMessageBatchResult sendMessageBatch(SendMessageBatchRequest request) { request.getRequestClientOptions().appendUserAgent(userAgent); return amazonSqsToBeExtended.sendMessageBatch(request); }
Example #19
Source File: PutSQS.java From nifi with Apache License 2.0 | 4 votes |
@Override public void onTrigger(final ProcessContext context, final ProcessSession session) { FlowFile flowFile = session.get(); if (flowFile == null) { return; } final long startNanos = System.nanoTime(); final AmazonSQSClient client = getClient(); final SendMessageBatchRequest request = new SendMessageBatchRequest(); final String queueUrl = context.getProperty(QUEUE_URL).evaluateAttributeExpressions(flowFile).getValue(); request.setQueueUrl(queueUrl); final Set<SendMessageBatchRequestEntry> entries = new HashSet<>(); final SendMessageBatchRequestEntry entry = new SendMessageBatchRequestEntry(); entry.setId(flowFile.getAttribute("uuid")); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); session.exportTo(flowFile, baos); final String flowFileContent = baos.toString(); entry.setMessageBody(flowFileContent); final Map<String, MessageAttributeValue> messageAttributes = new HashMap<>(); for (final PropertyDescriptor descriptor : userDefinedProperties) { final MessageAttributeValue mav = new MessageAttributeValue(); mav.setDataType("String"); mav.setStringValue(context.getProperty(descriptor).evaluateAttributeExpressions(flowFile).getValue()); messageAttributes.put(descriptor.getName(), mav); } entry.setMessageAttributes(messageAttributes); entry.setDelaySeconds(context.getProperty(DELAY).asTimePeriod(TimeUnit.SECONDS).intValue()); entries.add(entry); request.setEntries(entries); try { SendMessageBatchResult response = client.sendMessageBatch(request); // check for errors if (!response.getFailed().isEmpty()) { throw new ProcessException(response.getFailed().get(0).toString()); } } catch (final Exception e) { getLogger().error("Failed to send messages to Amazon SQS due to {}; routing to failure", new Object[]{e}); flowFile = session.penalize(flowFile); session.transfer(flowFile, REL_FAILURE); return; } getLogger().info("Successfully published message to Amazon SQS for {}", new Object[]{flowFile}); session.transfer(flowFile, REL_SUCCESS); final long transmissionMillis = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startNanos); session.getProvenanceReporter().send(flowFile, queueUrl, transmissionMillis); }
Example #20
Source File: PutSQS.java From localization_nifi with Apache License 2.0 | 4 votes |
@Override public void onTrigger(final ProcessContext context, final ProcessSession session) { FlowFile flowFile = session.get(); if (flowFile == null) { return; } final long startNanos = System.nanoTime(); final AmazonSQSClient client = getClient(); final SendMessageBatchRequest request = new SendMessageBatchRequest(); final String queueUrl = context.getProperty(QUEUE_URL).evaluateAttributeExpressions(flowFile).getValue(); request.setQueueUrl(queueUrl); final Set<SendMessageBatchRequestEntry> entries = new HashSet<>(); final SendMessageBatchRequestEntry entry = new SendMessageBatchRequestEntry(); entry.setId(flowFile.getAttribute("uuid")); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); session.exportTo(flowFile, baos); final String flowFileContent = baos.toString(); entry.setMessageBody(flowFileContent); final Map<String, MessageAttributeValue> messageAttributes = new HashMap<>(); for (final PropertyDescriptor descriptor : userDefinedProperties) { final MessageAttributeValue mav = new MessageAttributeValue(); mav.setDataType("String"); mav.setStringValue(context.getProperty(descriptor).evaluateAttributeExpressions(flowFile).getValue()); messageAttributes.put(descriptor.getName(), mav); } entry.setMessageAttributes(messageAttributes); entry.setDelaySeconds(context.getProperty(DELAY).asTimePeriod(TimeUnit.SECONDS).intValue()); entries.add(entry); request.setEntries(entries); try { client.sendMessageBatch(request); } catch (final Exception e) { getLogger().error("Failed to send messages to Amazon SQS due to {}; routing to failure", new Object[]{e}); flowFile = session.penalize(flowFile); session.transfer(flowFile, REL_FAILURE); return; } getLogger().info("Successfully published message to Amazon SQS for {}", new Object[]{flowFile}); session.transfer(flowFile, REL_SUCCESS); final long transmissionMillis = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startNanos); session.getProvenanceReporter().send(flowFile, queueUrl, transmissionMillis); }
Example #21
Source File: AmazonSQSExtendedClient.java From amazon-sqs-java-extended-client-lib with Apache License 2.0 | 3 votes |
/** * <p> * Delivers up to ten messages to the specified queue. This is a batch * version of SendMessage. The result of the send action on each message is * reported individually in the response. Uploads message payloads to Amazon * S3 when necessary. * </p> * <p> * If the <code>DelaySeconds</code> parameter is not specified for an entry, * the default for the queue is used. * </p> * <p> * <b>IMPORTANT:</b>The following list shows the characters (in Unicode) * that are allowed in your message, according to the W3C XML specification. * For more information, go to http://www.faqs.org/rfcs/rfc1321.html. If you * send any characters that are not included in the list, your request will * be rejected. #x9 | #xA | #xD | [#x20 to #xD7FF] | [#xE000 to #xFFFD] | * [#x10000 to #x10FFFF] * </p> * <p> * <b>IMPORTANT:</b> Because the batch request can result in a combination * of successful and unsuccessful actions, you should check for batch errors * even when the call returns an HTTP status code of 200. * </p> * <b>IMPORTANT:</b> The input object may be modified by the method. </p> * <p> * <b>NOTE:</b>Some API actions take lists of parameters. These lists are * specified using the param.n notation. Values of n are integers starting * from 1. For example, a parameter list with two elements looks like this: * </p> * <p> * <code>&Attribute.1=this</code> * </p> * <p> * <code>&Attribute.2=that</code> * </p> * * @param sendMessageBatchRequest * Container for the necessary parameters to execute the * SendMessageBatch service method on AmazonSQS. * * @return The response from the SendMessageBatch service method, as * returned by AmazonSQS. * * @throws BatchEntryIdsNotDistinctException * @throws TooManyEntriesInBatchRequestException * @throws BatchRequestTooLongException * @throws UnsupportedOperationException * @throws InvalidBatchEntryIdException * @throws EmptyBatchRequestException * * @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 SendMessageBatchResult sendMessageBatch(SendMessageBatchRequest sendMessageBatchRequest) { if (sendMessageBatchRequest == null) { String errorMessage = "sendMessageBatchRequest cannot be null."; LOG.error(errorMessage); throw new AmazonClientException(errorMessage); } sendMessageBatchRequest.getRequestClientOptions().appendUserAgent(SQSExtendedClientConstants.USER_AGENT_HEADER); if (!clientConfiguration.isLargePayloadSupportEnabled()) { return super.sendMessageBatch(sendMessageBatchRequest); } List<SendMessageBatchRequestEntry> batchEntries = sendMessageBatchRequest.getEntries(); int index = 0; for (SendMessageBatchRequestEntry entry : batchEntries) { if (clientConfiguration.isAlwaysThroughS3() || isLarge(entry)) { batchEntries.set(index, storeMessageInS3(entry)); } ++index; } return super.sendMessageBatch(sendMessageBatchRequest); }
Example #22
Source File: AmazonSQSExtendedClientBase.java From amazon-sqs-java-extended-client-lib with Apache License 2.0 | 2 votes |
/** * <p> * Delivers up to ten messages to the specified queue. This is a batch * version of SendMessage. The result of the send action on each message is * reported individually in the response. The maximum allowed individual * message size is 256 KB (262,144 bytes). * </p> * <p> * The maximum total payload size (i.e., the sum of all a batch's individual * message lengths) is also 256 KB (262,144 bytes). * </p> * <p> * If the <code>DelaySeconds</code> parameter is not specified for an entry, * the default for the queue is used. * </p> * <p> * <b>IMPORTANT:</b>The following list shows the characters (in Unicode) * that are allowed in your message, according to the W3C XML specification. * For more information, go to http://www.faqs.org/rfcs/rfc1321.html. If you * send any characters that are not included in the list, your request will * be rejected. #x9 | #xA | #xD | [#x20 to #xD7FF] | [#xE000 to #xFFFD] | * [#x10000 to #x10FFFF] * </p> * <p> * <b>IMPORTANT:</b> Because the batch request can result in a combination * of successful and unsuccessful actions, you should check for batch errors * even when the call returns an HTTP status code of 200. * </p> * <p> * <b>NOTE:</b>Some API actions take lists of parameters. These lists are * specified using the param.n notation. Values of n are integers starting * from 1. For example, a parameter list with two elements looks like this: * </p> * <p> * <code>&Attribute.1=this</code> * </p> * <p> * <code>&Attribute.2=that</code> * </p> * * @param sendMessageBatchRequest * Container for the necessary parameters to execute the * SendMessageBatch service method on AmazonSQS. * * @return The response from the SendMessageBatch service method, as * returned by AmazonSQS. * * @throws BatchEntryIdsNotDistinctException * @throws TooManyEntriesInBatchRequestException * @throws BatchRequestTooLongException * @throws UnsupportedOperationException * @throws InvalidBatchEntryIdException * @throws EmptyBatchRequestException * * @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 SendMessageBatchResult sendMessageBatch(SendMessageBatchRequest sendMessageBatchRequest) throws AmazonServiceException, AmazonClientException { return amazonSqsToBeExtended.sendMessageBatch(sendMessageBatchRequest); }
Example #23
Source File: AmazonSQSExtendedClient.java From amazon-sqs-java-extended-client-lib with Apache License 2.0 | 2 votes |
/** * <p> * Delivers up to ten messages to the specified queue. This is a batch * version of SendMessage. The result of the send action on each message is * reported individually in the response. Uploads message payloads to Amazon * S3 when necessary. * </p> * <p> * If the <code>DelaySeconds</code> parameter is not specified for an entry, * the default for the queue is used. * </p> * <p> * <b>IMPORTANT:</b>The following list shows the characters (in Unicode) * that are allowed in your message, according to the W3C XML specification. * For more information, go to http://www.faqs.org/rfcs/rfc1321.html. If you * send any characters that are not included in the list, your request will * be rejected. #x9 | #xA | #xD | [#x20 to #xD7FF] | [#xE000 to #xFFFD] | * [#x10000 to #x10FFFF] * </p> * <p> * <b>IMPORTANT:</b> Because the batch request can result in a combination * of successful and unsuccessful actions, you should check for batch errors * even when the call returns an HTTP status code of 200. * </p> * <p> * <b>NOTE:</b>Some API actions take lists of parameters. These lists are * specified using the param.n notation. Values of n are integers starting * from 1. For example, a parameter list with two elements looks like this: * </p> * <p> * <code>&Attribute.1=this</code> * </p> * <p> * <code>&Attribute.2=that</code> * </p> * * @param queueUrl * The URL of the Amazon SQS queue to take action on. * @param entries * A list of <a>SendMessageBatchRequestEntry</a> items. * * @return The response from the SendMessageBatch service method, as * returned by AmazonSQS. * * @throws BatchEntryIdsNotDistinctException * @throws TooManyEntriesInBatchRequestException * @throws BatchRequestTooLongException * @throws UnsupportedOperationException * @throws InvalidBatchEntryIdException * @throws EmptyBatchRequestException * * @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 SendMessageBatchResult sendMessageBatch(String queueUrl, List<SendMessageBatchRequestEntry> entries) { SendMessageBatchRequest sendMessageBatchRequest = new SendMessageBatchRequest(queueUrl, entries); return sendMessageBatch(sendMessageBatchRequest); }
Example #24
Source File: Queue.java From aws-sdk-java-resources with Apache License 2.0 | 2 votes |
/** * Performs the <code>SendMessages</code> action. * * <p> * The following request parameters will be populated from the data of this * <code>Queue</code> resource, and any conflicting parameter value set in * the request will be overridden: * <ul> * <li> * <b><code>QueueUrl</code></b> * - mapped from the <code>Url</code> identifier. * </li> * </ul> * * <p> * * @return The response of the low-level client operation associated with * this resource action. * @see SendMessageBatchRequest */ SendMessageBatchResult sendMessages(SendMessageBatchRequest request);
Example #25
Source File: Queue.java From aws-sdk-java-resources with Apache License 2.0 | 2 votes |
/** * Performs the <code>SendMessages</code> action and use a ResultCapture to * retrieve the low-level client response. * * <p> * The following request parameters will be populated from the data of this * <code>Queue</code> resource, and any conflicting parameter value set in * the request will be overridden: * <ul> * <li> * <b><code>QueueUrl</code></b> * - mapped from the <code>Url</code> identifier. * </li> * </ul> * * <p> * * @return The response of the low-level client operation associated with * this resource action. * @see SendMessageBatchRequest */ SendMessageBatchResult sendMessages(SendMessageBatchRequest request, ResultCapture<SendMessageBatchResult> extractor);