我正在使用laravel隊列在facebook上發表評論。當我從facebook的webhook接收數據時,基於接收到的細節,我對 發表了評論。爲了一次處理來自facebook webhook的100個響應,我使用laravel隊列,以便它可以逐個執行。 我已經使用了一步步的過程,如https://scotch.io/tutorials/why-laravel-queues-are-awesomeLaravel隊列不能正常工作
public function webhooks(Request $request)
{
$data = file_get_contents('php://input');
Log::info("Request Cycle with Queues Begins");
$job = (new webhookQueue($data)->delay(10);
$this->dispatch($job);
Log::info("Request Cycle with Queues Ends");
}
提到,這是我的作業類結構
class webhookQueue extends Job implements ShouldQueue
{
使用InteractsWithQueue,SerializesModels;
private $data;
public function __construct($data)
{
$this->data = $data;
}
public function handle()
{
//handling the data here
}
}
我打網絡掛接()函數不斷,所有的任務都在隊列同時但不工作,沒有任何工作都存儲在工作表中,我已經給了延遲,但它也是不工作,請有人幫助我,我一直試圖從昨天開始,但沒有結果。
這是我的日誌中laravel.log
[2017-02-08 14:18:42] local.INFO: Request Cycle with Queues Begins
[2017-02-08 14:18:44] local.INFO: Request Cycle with Queues Begins
[2017-02-08 14:18:47] local.INFO: Request Cycle with Queues Begins
[2017-02-08 14:18:47] local.INFO: Request Cycle with Queues Begins
[2017-02-08 14:18:47] local.INFO: Request Cycle with Queues Begins
[2017-02-08 14:18:47] local.INFO: Request Cycle with Queues Begins
[2017-02-08 14:18:48] local.INFO: Request Cycle with Queues Begins
[2017-02-08 14:18:48] local.INFO: Request Cycle with Queues Begins
[2017-02-08 14:18:48] local.INFO: Request Cycle with Queues Begins
[2017-02-08 14:18:48] local.INFO: Request Cycle with Queues Begins
[2017-02-08 14:18:48] local.INFO: Request Cycle with Queues Begins
[2017-02-08 14:18:48] local.INFO: Request Cycle with Queues Begins
[2017-02-08 14:18:55] local.INFO: Request Cycle with Queues Ends
[2017-02-08 14:18:55] local.INFO: Request Cycle with Queues Ends
[2017-02-08 14:18:55] local.INFO: Request Cycle with Queues Ends
[2017-02-08 14:18:59] local.INFO: Request Cycle with Queues Ends
[2017-02-08 14:19:00] local.INFO: Request Cycle with Queues Ends
[2017-02-08 14:19:00] local.INFO: Request Cycle with Queues Ends
[2017-02-08 14:19:00] local.INFO: Request Cycle with Queues Ends
[2017-02-08 14:19:01] local.INFO: Request Cycle with Queues Ends
[2017-02-08 14:19:01] local.INFO: Request Cycle with Queues Ends
[2017-02-08 14:19:01] local.INFO: Request Cycle with Queues Ends
[2017-02-08 14:19:01] local.INFO: Request Cycle with Queues Ends
[2017-02-08 14:19:01] local.INFO: Request Cycle with Queues Ends
是的,我已經做了這個,後php的工匠:偵聽命令,而數據正在處理,什麼都沒有進入cmd提示 –
我有解決方案,我沒有改變queue_drive數據庫,謝謝你的答覆。 –
@Mahdi - 嘿,命令應該是'php工匠隊列:聽'不是'php工匠:聽' – TipuZaynSultan