amazon-web-services - AWS Elastic Beanstalk - 启动 SWF 后台工作线程

标签 amazon-web-services cron backgroundworker amazon-elastic-beanstalk amazon-swf

我一直在尝试找出在 AWS Elastic beanstalk 上使用 PHP 运行后台作业的最佳方法,并且在 Google 和 SO 上搜索了数小时后,我相信一个很好的解决方案是使用 SWF 和事件工作人员。

我发现这个例子隐藏在 aws-sdk-for-php 中:https://github.com/amazonwebservices/aws-sdk-for-php/tree/master/_samples/AmazonSimpleWorkflow/cron

自述文件说:

To run this sample, you need to execute three scripts from the command line in separate terminal/console windows





Note that the start_cron_example_workflow.php script will exit quickly while the decider and activity worker scripts keep running until you manually terminate them.



决策者和事件 worker 将“永远”循环,而尝试在 EB 中运行这些是我遇到的麻烦。

在我的 .ebextensions 目录中,我有一个执行这些文件的文件:
container_commands:
  01background_task: 
    command: "php -f start_cron_example_activity_workers.php"
  02background_task: 
    command: "php -f start_cron_example_workflow_workers.php"

但我收到以下错误消息:

错误
无法部署应用程序版本。

错误
一些实例没有响应命令。未收到 [i-a5417ed4] 的回复。

有什么办法可以使用配置文件来做到这一点?如何在不引入单点故障的情况下在 AWS EB 中进行这项工作?

谢谢你。

最佳答案

您可能会考虑使用像 IronWorker 这样的服务— 这是专门为您尝试做的事情而设计的,并且可能比在微型实例上组合您自己的解决方案更有效。

我没用过Iron.io尚未,但正在评估它,因为我希望将我的东西转移到 AWS,所以我还需要处理 cron 作业。

关于amazon-web-services - AWS Elastic Beanstalk - 启动 SWF 后台工作线程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14409665/

相关文章:

c# - 进度条未按预期达到 100%

amazon-s3 - 访问s3n中的文件://elasticmapreduce/samples/wordcount/input

cron - Django 管理命令 Cron on Dotcloud

c# - 尝试将 float 转换为 Int32 时 Convert.ToInt32(float) 失败

linux - 从 cron 中的另一个脚本运行 sh 脚本

node.js - 用于创建另一个 AWS lambda 函数的 AWS Lambda 函数

C# BackgroundWorker 和 ProgressBar 问题

amazon-web-services - S3 减速 : Please reduce your request rate exception

java - 是否有任何通用的 API/SDK 可以将自定义标签添加到现有的 AWS 资源?

node.js - 在哪里调用 DynamoDB 实例?一次还是每个请求一次?