简体   繁体   中英

Laravel-5.8: Not getting output on Queue Jobs

I am implementing Queue JOBS, in my Laravel Project for the first time. But I am facing some difficulties on it, as after php artisan queue:work , noting is showing on the terminal.

Let Me describe, the procedure I have tried.

  1. My Controller Function, from where I am trying to fire the Job Queue:
    use App\Jobs\InitiateRecharge;
    /
    /*** Other Codes are here....
    /
    public function testQueueJob(){
        InitiateRecharge::dispatch(1)->onQueue('initrecharge');

        return 1;
    }
  1. My JOB Queue Class:
<?php

namespace App\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;

class InitiateRecharge implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    protected $reportid;
    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($reportid)
    {
        $this->reportid = $reportid;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        sleep(10);
        \Log::info('hello....');
    }
}

  1. I have also migrated the jobs table, and rows are also getting inserted on that.

It's is not giving any error, but the Job expected output is also not coming .. and in the terminal noting getting changed.

Please, anyone, help me Thank You in advance :)

尝试 php artisan queue:listen --tries=1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM