untymage's avatar

How to ignore ShouldQueue in lumen app

In lumen app there is a Job class which implemented ShouldQueue interface, How can i ignore this for one sub class ? is there any method something like sendSync in lumen ?

<?php

namespace App\Jobs;

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

abstract class Job implements ShouldQueue
{
    /*
    |--------------------------------------------------------------------------
    | Queueable Jobs
    |--------------------------------------------------------------------------
    |
    | This job base class provides a central location to place any logic that
    | is shared across all of your jobs. The trait included with the class
    | provides access to the "queueOn" and "delay" queue helper methods.
    |
    */

    use InteractsWithQueue, Queueable, SerializesModels;
}

I have 10 job which extended job class but i want to sent sync job for one of my job and i dont want to remove it just because of one job

0 likes
1 reply
martinbean's avatar
Level 80

@untymage You can’t “remove” an interface if you’re extending a class.

Use the appropriate helper function if you want to dispatch it synchronously, but that defeats the point of using a queued job in the first place:

dispatch_now(SomeJobClass::class);

Please or to participate in this conversation.