0

Iam new to SQS php SDK, Iam not able to override RedrivePolicy using setQueueAttributes method :(

json string is not accepted as an attribute and I cannot find any clear resources to help me.

Code lover
  • 11
  • 1

1 Answers1

0

Have a look at the below example code:

$queueUrl = "QUEUE_URL";
$client = new SqsClient([
    'profile' => 'default',
    'region' => 'us-west-2',
    'version' => '2012-11-05'
]);
try {
    $result = $client->setQueueAttributes(array(
        'Attributes' => [
            'ReceiveMessageWaitTimeSeconds' => 20
        ],
        'QueueUrl' => $queueUrl, // REQUIRED
    ));
    var_dump($result);
} catch (AwsException $e) {
    // output error message if fails
    error_log($e->getMessage());
}

Full code:

https://github.com/awsdocs/aws-doc-sdk-examples/blob/master/php/example_code/sqs/LongPollingSetQueueAttributes.php

Shashank Agarwal
  • 712
  • 8
  • 14