php - 具有 Elastic Beanstalk 的 Amazon SQS 服务

标签 php amazon-web-services amazon-elastic-beanstalk amazon-sqs

我对 Amazon SQS 相当陌生,我很难理解发生了什么。我将 HTTP 路径设置为可以处理请求的文件。但我不确定这是否是正确的做法。正确的方法是什么?为什么消息会直接转到“飞行中”?当消息发送到 HTTP 路径时会发生什么?我在我的应用程序中使用 php,所以如果有人可以指导我做错了什么,那么我将不胜感激!

当我使用 php 脚本检查消息时,如下所示:

$sqs_client = new SqsClient($sqs_credentials);

// Get the queue URL from the queue name.
$result = $sqs_client->getQueueUrl(array('QueueName' => "NormalPoll"));
$queue_url = $result->get('QueueUrl');

// Receive a message from the queue
$result = $sqs_client->receiveMessage(array(
    'QueueUrl' => $queue_url
));

if ($result['Messages'] == null) {
    die('No Message');
}

// Get the message information
$result_message = array_pop($result['Messages']);
$body = $result_message['Body'];
print $body;

运行程序时我总是收到“无消息”的返回。我通过 AWS SQS 控制台插入了一条消息,但无法接收它。该消息自动转至“飞行中”。

提前致谢!

最佳答案

由于 beanstalk 工作环境配置,消息正在传输中。 以下文档提供了有关如何配置 beanstalk 工作环境的详细信息。 http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features-managing-env-tiers.html

关于php - 具有 Elastic Beanstalk 的 Amazon SQS 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37262886/

相关文章:

javascript - 使用 aws js sdk 将大文件(>10GB)直接从浏览器安全地分段上传到 s3,而无需使用 cognito

amazon-web-services - Elastic Beanstalk 条件container_commands 不起作用

php - 在 PHP 脚本中删除双引号的 SQL 查询不起作用

php - 实现 PHP 编码标准

amazon-web-services - 在相同对等点的集群中调度任务

python - AWS Cognito 和 Lambda : add federated identity to user pool

php - Laravel 中的 Controller 构造函数

php - 了解黑客尝试

amazon-web-services - 如何使用 Elastic beanstalk 和 Dockerrun.aws.json 正确部署到 AWS?

amazon-web-services - 具有 API Gateway 的 Amazon Lambda 与 REST API 的 Elastic Beanstalk