0

我是 SQS php SDK 的新手,我无法使用 setQueueAttributes 方法覆盖 RedrivePolicy :(

json 字符串不被接受为属性,我找不到任何明确的资源来帮助我。

4

1 回答 1

0

看看下面的示例代码:

$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());
}

完整代码:

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

于 2017-04-24T22:41:19.027 回答