Example usage for com.amazonaws.services.sqs.model.transform CreateQueueResultStaxUnmarshaller CreateQueueResultStaxUnmarshaller

List of usage examples for com.amazonaws.services.sqs.model.transform CreateQueueResultStaxUnmarshaller CreateQueueResultStaxUnmarshaller

Introduction

In this page you can find the example usage for com.amazonaws.services.sqs.model.transform CreateQueueResultStaxUnmarshaller CreateQueueResultStaxUnmarshaller.

Prototype

CreateQueueResultStaxUnmarshaller

Source Link

Usage

From source file:com.kolich.aws.services.sqs.impl.KolichSQSClient.java

License:Open Source License

@Override
public Either<HttpFailure, CreateQueueResult> createQueue(final String queueName,
        final Integer defaultVisibilityTimeout) {
    return new AwsSQSHttpClosure<CreateQueueResult>(client_, SC_OK, new CreateQueueResultStaxUnmarshaller()) {
        @Override//from w w  w  .  j a  va 2 s.  c  o  m
        public void validate() throws Exception {
            checkNotNull(queueName, "Queue name cannot be null.");
            checkState(isValidQueueName(queueName),
                    "Invalid queue name, " + "did not match expected queue name pattern.");
            if (defaultVisibilityTimeout != null) {
                checkState(defaultVisibilityTimeout <= SQS_MAX_VISIBILITY_TIMEOUT,
                        "Default visibility timeout cannot be greater than: " + SQS_MAX_VISIBILITY_TIMEOUT);
            }
        }

        @Override
        public void prepare(final AwsHttpRequest request) throws Exception {
            request.addParameter(SQS_ACTION_PARAM, SQS_ACTION_CREATE_QUEUE);
            request.addParameter(SQS_QUEUE_NAME_PARAM, queueName);
            if (defaultVisibilityTimeout != null) {
                request.addParameter(SQS_DEFAULT_VISIBILITY_TIMEOUT_PARAM,
                        Integer.toString(defaultVisibilityTimeout));
            }
        }
    }.post();
}