Examples of SendMessageBatchRequest


Examples of com.amazonaws.services.sqs.model.SendMessageBatchRequest

                new SendMessageBatchRequestEntry("id4", "This is the 4th message in a batch"),
                new SendMessageBatchRequestEntry("id5", "This is the 5th message in a batch"),
                new SendMessageBatchRequestEntry("id6", "This is the 6th message in a batch")
            );
           
            SendMessageBatchRequest batchSendRequest = new SendMessageBatchRequest(queueUrl, messageList);
            cqs1.sendMessageBatch(batchSendRequest);
           
        } catch (AmazonServiceException ase) {
          logger.error("test failed", ase);
          fail("exception where none expected");
View Full Code Here

Examples of com.amazonaws.services.sqs.model.SendMessageBatchRequest

                new SendMessageBatchRequestEntry("id1", "This is the first message in a batch"),
                new SendMessageBatchRequestEntry("id.1", "This is the second message in a batch"),
                new SendMessageBatchRequestEntry("id3", "This is the third message in a batch")
            );
           
            SendMessageBatchRequest batchSendRequest = new SendMessageBatchRequest(queueUrl, messageList);
            cqs1.sendMessageBatch(batchSendRequest);
            fail("missing expected exception");
           
        } catch (AmazonServiceException ase) {
            assertTrue("Did not get invalid batch entry id exception", ase.getErrorCode().contains(CQSErrorCodes.InvalidBatchEntryId.getCMBCode()));
        }

        logger.info("Send a batch of messages with empty message");
       
        try {
         
            List<SendMessageBatchRequestEntry> messageList = Arrays.asList(
                new SendMessageBatchRequestEntry("id1", "This is the first message in a batch"),
                new SendMessageBatchRequestEntry("id2", "This is the second message in a batch"),
                new SendMessageBatchRequestEntry("id3", "")
            );
           
            SendMessageBatchRequest batchSendRequest = new SendMessageBatchRequest(queueUrl, messageList);
            cqs1.sendMessageBatch(batchSendRequest);
           
        } catch (AmazonServiceException ase) {
            fail(ase.getMessage());
        }

        logger.info("Send a batch of messages with same supplied id");
       
        try {
         
            List<SendMessageBatchRequestEntry> messageList = Arrays.asList(
                new SendMessageBatchRequestEntry("1", "This is the first message in a batch"),
                new SendMessageBatchRequestEntry("2", "This is the second message in a batch"),
                new SendMessageBatchRequestEntry("1", "Test")
            );
           
            SendMessageBatchRequest batchSendRequest = new SendMessageBatchRequest(queueUrl, messageList);
            cqs1.sendMessageBatch(batchSendRequest);
            fail("missing expected exception");
           
        } catch (AmazonServiceException ase) {
            //assertTrue("Did not get batch entry id not distinct exception", ase.getErrorCode().contains(CQSErrorCodes.BatchEntryIdsNotDistinct.getCMBCode()));
        }

        logger.info("Send a batch of messages with supplied id too long");
       
        try {
         
            List<SendMessageBatchRequestEntry> messageList = Arrays.asList(
                new SendMessageBatchRequestEntry("1", "This is the first message in a batch"),
                new SendMessageBatchRequestEntry("2", "This is the second message in a batch"),
                new SendMessageBatchRequestEntry("123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", "Test")
            );
           
            SendMessageBatchRequest batchSendRequest = new SendMessageBatchRequest(queueUrl, messageList);
            cqs1.sendMessageBatch(batchSendRequest);
            fail("missing expected exception");
           
        } catch (AmazonServiceException ase) {
            assertTrue("Did not get invalid batch entry id", ase.getErrorCode().contains(CQSErrorCodes.InvalidBatchEntryId.getCMBCode()));
        }

        logger.info("Send a batch of messages total length over 64KB");
       
        try {
            char[] chars = new char[300*1024 - 10];
            java.util.Arrays.fill(chars, 'x');
            List<SendMessageBatchRequestEntry> messageList = Arrays.asList(
                new SendMessageBatchRequestEntry("1", "This is the first message in a batch"),
                new SendMessageBatchRequestEntry("2", "This is the second message in a batch"),
                new SendMessageBatchRequestEntry("3", new String(chars))
            );
            SendMessageBatchRequest batchSendRequest = new SendMessageBatchRequest(queueUrl, messageList);
            cqs1.sendMessageBatch(batchSendRequest);
            fail("missing expected exception");
        } catch (AmazonServiceException ase) {
            assertTrue("Did not get batch request too long exception", ase.getErrorCode().contains(CQSErrorCodes.BatchRequestTooLong.getCMBCode()));
        }
View Full Code Here

Examples of com.amazonaws.services.sqs.model.SendMessageBatchRequest

            // send batch of messages

            logger.info("Sending batch messages to " + queueUrl);
           
            SendMessageBatchRequest sendMessageBatchRequest = new SendMessageBatchRequest(queueUrl);
            List<SendMessageBatchRequestEntry> sendEntryList = new ArrayList<SendMessageBatchRequestEntry>();

            for (int i = 0; i < 5; i++) {
                sendEntryList.add(new SendMessageBatchRequestEntry("msg_" + i, "This is a test message: batch " + i));
            }
           
            sendMessageBatchRequest.setEntries(sendEntryList);
            cqs1.sendMessageBatch(sendMessageBatchRequest);
           
            Thread.sleep(1000);

            // receive messages
View Full Code Here

Examples of com.amazonaws.services.sqs.model.SendMessageBatchRequest

            // send batch of messages

            logger.info("Sending batch messages to " + queueUrl);
           
            SendMessageBatchRequest sendMessageBatchRequest = new SendMessageBatchRequest(queueUrl);
            List<SendMessageBatchRequestEntry> sendEntryList = new ArrayList<SendMessageBatchRequestEntry>();

            for (int i = 0; i < 5; i++) {
                sendEntryList.add(new SendMessageBatchRequestEntry("msg_" + i, "This is a test message: batch " + i));
            }
           
            sendMessageBatchRequest.setEntries(sendEntryList);
            cqs1.sendMessageBatch(sendMessageBatchRequest);
           
            Thread.sleep(1000);
           
            // receive messages
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.