In Laravel how to create a queue object and set their connection without Facade In Laravel how to create a queue object and set their connection without Facade laravel laravel

In Laravel how to create a queue object and set their connection without Facade


As @Mois44 alluded to, you should be able to accomplish this with the QueueManager.

The QueueManager will allow you to call the connection() method, which will return a Queue object. And from here, you can call the normal queued functions (pushOn, laterOn, etc)

// Returns an Illuminate\Queue\QueueManager object$queueManager = app('queue'); // Returns an Illuminate\Queue\Queue object$queue = $queueManager->connection('my-connection'); $queue->pushOn('queue_name', $job);

or all chained together

app('queue')->connection('my-connection')->pushOn('queue_name', $job)

Admittedly, my Lumen specific knowledge is pretty limited. If the app() method doesn't work to get an instance of the QueueMananger, then I'm not sure what to do.