【发布时间】:2016-12-30 13:16:39
【问题描述】:
我有一个队列运行一些回调请求到我的用户端点。
这是我队列的代码。
public function handle()
{
//send webrequest here....
//check the response of user backend
if ($res->getStatusCode() != 200 || $res->getBody()->getContents() != "*received*")
throw new Exception('callback url not reachable');
}
public function failed(Exception $exception)
{
//check tries and try again if needed
//check if job failed for 5 times
//if not ->retry again in 5 minutes, increment the times tried
//if yes ->disable API access, send email
Log::info("user email send, callback disabled!");
}
当 webrequest answer 为 != "received" 并检查某个作业是否失败 5 次时,如何让作业失败(我当前的异常使整个作业结束)? 如果作业失败,则应在 5 分钟内重试。
关于这些点我不明白文档。
【问题讨论】:
标签: exception laravel-5.3 task-queue