0

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 :)

1
  • did you run php artisan queue:restart after the changes ? Commented Aug 31, 2020 at 15:21

1 Answer 1

0

try php artisan queue:listen --tries=1

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.