Sets the value of one or more queue attributes. Valid attributes that can be set are [VisibilityTimeout, Policy, MaximumMessageSize, MessageRetentionPeriod, ReceiveMessageWaitTimeSeconds].
Access
public
Parameters
Parameter |
Type |
Required |
Description |
---|---|---|---|
|
Required |
The URL of the SQS queue to take action on. |
|
|
Required |
A map of attributes to set.
|
|
|
Optional |
An associative array of parameters that can have the following keys:
|
Returns
Type |
Description |
---|---|
A |
Examples
Pass one or more Name-Value pairs to change the queue attributes.
// Change visibility timeout $sqs = new AmazonSQS(); $response = $sqs->set_queue_attributes('example-queue', array( array( // Attribute.0 'Name' => 'VisibilityTimeout', 'Value' => 7200 ) )); // Success? var_dump($response->isOK());Result:
bool(true)
Set a policy on the queue.
// Change visibility timeout $sqs = new AmazonSQS(); $queue_url = 'https://sqs.us-east-1.amazonaws.com/123456789012/my-queue'; $topic_arn = 'arn:aws:sns:us-east-1:123456789012:my-topic'; // Create a new policy to manage resource permissions $policy = new CFPolicy($sqs, array( 'Version' => '2008-10-17', 'Id' => 'my-policy-id', 'Statement' => array( array( // Statement #1 'Resource' => $sqs->get_queue_arn($queue_url), // Set the queue ARN 'Effect' => 'Allow', 'Sid' => 'my-rule', 'Action' => 'sqs:*', 'Condition' => array( 'StringEquals' => array( 'aws:SourceArn' => $topic_arn ) ), 'Principal' => array( 'AWS' => '*' ) ) ) )); $response = $sqs->set_queue_attributes('example-queue', array( array( // Attribute #1 'Name' => 'Policy', 'Value' => $policy->get_json() ) )); // Success? var_dump($response->isOK());Result:
bool(true)
Related Methods
Source
Method defined in services/sqs.class.php | Toggle source view (12 lines) | View on GitHub