Laravel create job on queue

user7678643 picture user7678643 · Sep 12, 2018 · Viewed 7.5k times · Source

I am facing an issue on Laravel 5.7 with Jobs and QUEUE,

The job is processing but is not entered in queue, i can't see also anything on database - however, i am mentioned gain that is job occurred without issues, but the scope is to be on queue, please.

.env

QUEUE_DRIVER=database

Job

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

    protected $value;
    protected $value1;
    protected $value2;
    protected $value3;

    public $tries = 5;

    public function __construct($value, $value1, $value2, $value3)
    {
        $this->value = $value;
        $this->value1 = $value1;
        $this->value2 = $value2;
        $this->value3 = $value4;
    }

    public function handle()
    {
        $url = 'https://somewhere';

        $client = new \GuzzleHttp\Client;
        $response = $client->post($url, [
                'form_params' => [ 
                    'session' => $this->value,
                    'appid' => $this->value1,
                    'env' => $this->value2,
                    'nodes' => $this->value3
                ]
        ]);

        $response = json_decode($response->getBody(), true);
        return $response;
    }
}

Controller

use App\Jobs\CreateApplication;
...
CreateApplication::dispatch($value, $value1, $value2, $value3)->onQueue('processing');

Terminal

php artisan queue:listen

php artisan queue:table
php artisan queue:failed-table

Migrating: 2018_09_12_182619_create_jobs_table
Migrated:  2018_09_12_182619_create_jobs_table
Migrating: 2018_09_12_191537_create_failed_jobs_table
Migrated:  2018_09_12_191537_create_failed_jobs_table

After several tries no data in database at all, on both tables.

Any advice please?

Answer

user7678643 picture user7678643 · Sep 13, 2018

The issue was related at the .env file on

QUEUE_DRIVER=database

As it looks on Laravel 5.7 it needs to be

QUEUE_CONNECTION=database