com.amazonaws.services.sqs.model.SetQueueAttributesResult Java Examples

The following examples show how to use com.amazonaws.services.sqs.model.SetQueueAttributesResult. 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: AmazonSQSIdleQueueDeletingClient.java    From amazon-sqs-java-temporary-queues-client with Apache License 2.0 5 votes vote down vote up
@Override
public SetQueueAttributesResult setQueueAttributes(SetQueueAttributesRequest request) {
    SetQueueAttributesResult result = super.setQueueAttributes(request);

    QueueMetadata queue = queues.get(request.getQueueUrl());
    if (queue != null) {
        queue.attributes.putAll(request.getAttributes());
    }

    return result;
}
 
Example #2
Source File: AmazonSQSVirtualQueuesClient.java    From amazon-sqs-java-temporary-queues-client with Apache License 2.0 5 votes vote down vote up
@Override
public SetQueueAttributesResult setQueueAttributes(SetQueueAttributesRequest request) {
    if (VirtualQueueID.fromQueueUrl(request.getQueueUrl()).isPresent()) {
        throw new IllegalArgumentException("Cannot change queue attributes of virtual queues after creation: " + request.getQueueUrl());
    } else {
        return amazonSqsToBeExtended.setQueueAttributes(request);
    }
}
 
Example #3
Source File: SQSObservableQueue.java    From conductor with Apache License 2.0 5 votes vote down vote up
private void addPolicy(List<String> accountsToAuthorize) {
	if(accountsToAuthorize == null || accountsToAuthorize.isEmpty()) {
		logger.info("No additional security policies attached for the queue " + queueName);
		return;
	}
	logger.info("Authorizing " + accountsToAuthorize + " to the queue " + queueName);
	Map<String, String> attributes = new HashMap<>();
	attributes.put("Policy", getPolicy(accountsToAuthorize));
	SetQueueAttributesResult result = client.setQueueAttributes(queueURL, attributes);
	logger.info("policy attachment result: " + result);
	logger.info("policy attachment result: status=" + result.getSdkHttpMetadata().getHttpStatusCode());
}
 
Example #4
Source File: AbstractAmazonSQSClientWrapper.java    From amazon-sqs-java-temporary-queues-client with Apache License 2.0 4 votes vote down vote up
@Override
public SetQueueAttributesResult setQueueAttributes(SetQueueAttributesRequest request) {
    request.getRequestClientOptions().appendUserAgent(userAgent);
    return amazonSqsToBeExtended.setQueueAttributes(request);
}
 
Example #5
Source File: AmazonSQSExtendedClientBase.java    From amazon-sqs-java-extended-client-lib with Apache License 2.0 2 votes vote down vote up
/**
 * <p>
 * Sets the value of one or more queue attributes. When you change a queue's
 * attributes, the change can take up to 60 seconds for most of the
 * attributes to propagate throughout the SQS system. Changes made to the
 * <code>MessageRetentionPeriod</code> attribute can take up to 15 minutes.
 * </p>
 * <p>
 * <b>NOTE:</b>Going forward, new attributes might be added. If you are
 * writing code that calls this action, we recommend that you structure your
 * code so that it can handle new attributes gracefully.
 * </p>
 * 
 * @param queueUrl
 *            The URL of the Amazon SQS queue to take action on.
 * @param attributes
 *            A map of attributes to set.
 *            <p>
 *            The following lists the names, descriptions, and values of the
 *            special request parameters the <code>SetQueueAttributes</code>
 *            action uses:
 *            <p>
 *            <ul>
 *            <li><code>DelaySeconds</code> - The time in seconds that the
 *            delivery of all messages in the queue will be delayed. An
 *            integer from 0 to 900 (15 minutes). The default for this
 *            attribute is 0 (zero).</li>
 *            <li><code>MaximumMessageSize</code> - The limit of how many
 *            bytes a message can contain before Amazon SQS rejects it. An
 *            integer from 1024 bytes (1 KiB) up to 262144 bytes (256 KiB).
 *            The default for this attribute is 262144 (256 KiB).</li>
 *            <li><code>MessageRetentionPeriod</code> - The number of
 *            seconds Amazon SQS retains a message. Integer representing
 *            seconds, from 60 (1 minute) to 1209600 (14 days). The default
 *            for this attribute is 345600 (4 days).</li>
 *            <li><code>Policy</code> - The queue's policy. A valid AWS
 *            policy. For more information about policy structure, see <a
 *            href=
 *            "http://docs.aws.amazon.com/IAM/latest/UserGuide/PoliciesOverview.html"
 *            >Overview of AWS IAM Policies</a> in the <i>Amazon IAM User
 *            Guide</i>.</li>
 *            <li><code>ReceiveMessageWaitTimeSeconds</code> - The time for
 *            which a ReceiveMessage call will wait for a message to arrive.
 *            An integer from 0 to 20 (seconds). The default for this
 *            attribute is 0.</li>
 *            <li><code>VisibilityTimeout</code> - The visibility timeout
 *            for the queue. An integer from 0 to 43200 (12 hours). The
 *            default for this attribute is 30. For more information about
 *            visibility timeout, see Visibility Timeout in the <i>Amazon
 *            SQS Developer Guide</i>.</li>
 *            <li><code>RedrivePolicy</code> - The parameters for dead
 *            letter queue functionality of the source queue. For more
 *            information about RedrivePolicy and dead letter queues, see
 *            Using Amazon SQS Dead Letter Queues in the <i>Amazon SQS
 *            Developer Guide</i>.</li>
 *            </ul>
 * 
 * @return The response from the SetQueueAttributes service method, as
 *         returned by AmazonSQS.
 * 
 * @throws InvalidAttributeNameException
 *
 * @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 SetQueueAttributesResult setQueueAttributes(String queueUrl, Map<String, String> attributes)
		throws AmazonServiceException, AmazonClientException {

	return amazonSqsToBeExtended.setQueueAttributes(queueUrl, attributes);
}
 
Example #6
Source File: AmazonSQSExtendedClientBase.java    From amazon-sqs-java-extended-client-lib with Apache License 2.0 1 votes vote down vote up
/**
 * <p>
 * Sets the value of one or more queue attributes. When you change a queue's
 * attributes, the change can take up to 60 seconds for most of the
 * attributes to propagate throughout the SQS system. Changes made to the
 * <code>MessageRetentionPeriod</code> attribute can take up to 15 minutes.
 * </p>
 * <p>
 * <b>NOTE:</b>Going forward, new attributes might be added. If you are
 * writing code that calls this action, we recommend that you structure your
 * code so that it can handle new attributes gracefully.
 * </p>
 *
 * @param setQueueAttributesRequest
 *            Container for the necessary parameters to execute the
 *            SetQueueAttributes service method on AmazonSQS.
 * 
 * 
 * @throws InvalidAttributeNameException
 *
 * @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 SetQueueAttributesResult setQueueAttributes(SetQueueAttributesRequest setQueueAttributesRequest)
		throws AmazonServiceException, AmazonClientException {

	return amazonSqsToBeExtended.setQueueAttributes(setQueueAttributesRequest);

}