当我这样称呼时:
$data = \Redis::lrange('queues:high', 0, -1);
print_r($data[0];);
我看到了:
{
"job": "Illuminate\\Queue\\CallQueuedHandler@call",
"data": {
"commandName": "App\\Jobs\\SyncProduct",
"command": "..."
},
"id": "CXAfF3aFL6CT06X0sI1veXADgv8ipqUi",
"attempts": 1
}
如何从laravel代码,内部作业或调度程序对象中获取此作业ID(CXAfF3aFL6CT06X0sI1veXADgv8ipqUi)?
答案 0 :(得分:2)
从您的工作内部,您可以尝试访问基础工作:
// for a job using the `InteractsWithQueue` trait
$this->job->getJobId();