Examples of SQSRuntimeException


Examples of com.softwaremill.common.sqs.exception.SQSRuntimeException

        try {
            GetQueueUrlResult url = sqsClient.getQueueUrl(new GetQueueUrlRequest(queueName));
            return new Queue(queueName, url.getQueueUrl(), sqsClient);
        } catch (QueueDoesNotExistException e) {
            throw new SQSRuntimeException(String.format("Queue \"%s\" does not exist.", queueName), e);
        } catch (AmazonServiceException e) {
            throw new SQSRuntimeException("AWS exception.",  e);
        }
    }
View Full Code Here

Examples of com.softwaremill.common.sqs.exception.SQSRuntimeException

    private MessageId sendSerializableInternal(Serializable object, Optional<Duration> duration) {
        String encodedMessage;
        try {
            encodedMessage = Util.serializeToBase64(object);
        } catch (IOException e) {
            throw new SQSRuntimeException("Could not serialize message.", e);
        }

        checkState(encodedMessage.length() <= 64 * 1024);

        LOG.debug("Serialized Message: " + encodedMessage);

        SendMessageRequest request = new SendMessageRequest(url, encodedMessage);
        if (duration.isPresent()) {
            request.withDelaySeconds((int) duration.get().getStandardSeconds());
        }

        for (int i = 0; i < DELIVERY_RETRY_LIMIT; ++i) {
            try {
                /* No verification of message checksum is done at this point. It might get added in the future, though. */

                return new MessageId(sqsClient.sendMessage(request).getMessageId());
            } catch (AmazonServiceException e) {
                LOG.warn(format("Could not sent message to SQS queue: %s. Retrying.", url), e);
                try {
                    Thread.sleep(DELIVERY_RETRY_SLEEP_TIME_IN_MILLIS);
                } catch (InterruptedException e1) {
                    // Ignore
                }
            }
        }
        throw new SQSRuntimeException("Exceeded redelivery value: " + DELIVERY_RETRY_LIMIT + "; message not sent!");
    }
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.