mercredi 6 mai 2020

Why Laravel uses the default queue connection even if I specified a queue with different connection

I have problem with laravel queues. In my project, default connection is sync, I want to add sqs connection for one type of jobs.

When I dispatch job in this way:

TestAction::dispatch()->onQueue('test');

Job is performed immediately (by sync connection).

If I dispatch job in this way:

TestAction::dispatch()->onQueue('test')->onConnection('sqsTestAction');

everything is ok.

Queue "test" is in sqsTestAction connection, why in first example job is being sent by sync connection?

My config/queue.php:


    'default' => env('QUEUE_CONNECTION', 'sync'),


    'connections' => [

        'sync' => [
            'driver' => 'sync',
        ],

        'sqsTestAction' => [
            'driver' => 'sqs',
            'key' => env('AWS_ACCESS_KEY_ID'),
            'secret' => env('AWS_SECRET_ACCESS_KEY'),
            'prefix' => env('AWS_SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
            'queue' => "test",
            'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
        ],

    ],

Laravel ver 5.8



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire