AWS SQS消息无法自动接收

时间:2018-12-06 07:34:35

标签: php amazon-web-services

我正在使用aws sqs,发送消息成功,但是未收到未自动获得的消息。

请帮助我。

require 'vendor/autoload.php';
//require 'aws/aws-autoloader.php';

use Aws\Exception\AwsException;
use Aws\Sqs\SqsClient;

$queueUrl = "";

$client = SqsClient::factory(array(
    'credentials' => array(
        'key' => '', //use your AWS key here
        'secret' => '', //use your AWS secret here
    ),

    'region' => 'us-east-1', //replace it with your region
    'version' => 'latest',
));

$result = $client->receiveMessage(array(
    'QueueUrl' => $queueUrl,
    'MaxNumberOfMessages' => 10,
));

foreach ($result->get('Messages') as $message) {
    echo "<pre>";
    echo htmlentities(print_r($message['Body'], true));
    echo "</pre>";

    echo "<hr />";
}

0 个答案:

没有答案