【发布时间】:2019-03-22 03:05:18
【问题描述】:
我在使用 Symfony 应用程序的 ElasticBeanstalk Worker Tier 上的周期性任务遇到问题。
我在 App Server 和 Worker Tier 上部署了相同的源代码。 我已经设置了我的 cron.yaml 文件并且它已成功加载。 消息已发送,但我收到 406 错误:
"POST /worker/reclamation/auto-reply HTTP/1.1" 406 481 "-" "aws-sqsd/2.4"
我的 cron.yaml 文件:
version: 1
cron:
- name: "reclamation-reply"
url: "/worker/reclamation/auto-reply"
schedule: "*/10 * * * *"
URL 是发送 POST 请求以触发 工作。
从那里,我决定使用 POST 方法编写一个 FOSRest 路由,在该方法中我触发了我需要运行的命令。 我不知道这样做是否正确,所以,我想我的问题可能来自这里。
/**
* @FOSRest\Route("/worker")
*/
class WorkerController extends AbstractController
{
/**
* @FOSRest\Post("/reclamation/auto-reply")
*/
public function ticketReply(KernelInterface $kernel)
{
$application = new Application($kernel);
$application->setAutoExit(false);
$input = new ArrayInput(array(
'command' => 'app:reclamation:reply',
));
$output = new NullOutput();
$application->run($input, $output);
return new Response("");
}
提前感谢您的帮助!
【问题讨论】:
标签: symfony cron amazon-elastic-beanstalk periodic-task