laravel-plain-sqs icon indicating copy to clipboard operation
laravel-plain-sqs copied to clipboard

Can I using multiple connections for sending or listen queues?

Open gemaralali opened this issue 5 years ago • 3 comments

I am using PHP >=5.6.4 & Lumen 5.5.* & laravel-plain-sqs ^0.1.16

in config/queue.php

'connections' => [ 'sqs-plain' => [ 'driver' => 'sqs-plain', 'key' => env('SQS_KEY', 'key'), 'secret' => env('SQS_SECRET', 'secret'), 'prefix' => env('SQS_PREFIX', 'prefix'), 'queue' => env('SQS_URL', 'queue'), 'region' => env('SQS_REGION', 'region'), ], 'sqs-plain-2' => [ 'driver' => 'sqs-plain-2', 'key' => env('SQS_KEY_2', 'key'), 'secret' => env('SQS_SECRET_2', 'secret'), 'prefix' => env('SQS_PREFIX_2', 'prefix'), 'queue' => env('SQS_URL_2', 'queue'), 'region' => env('SQS_REGION_2', 'region'), ] ]

what did I do to use multiple connections? whether I must do any configuration something for this?

Any suggestions would be helpful.

gemaralali avatar Dec 31 '19 05:12 gemaralali

Can you explain your use case ? Why different drivers ?

pmayet avatar Mar 10 '20 12:03 pmayet

I am using PHP >=5.6.4 & Lumen 5.5.* & laravel-plain-sqs ^0.1.16

in config/queue.php

'connections' => [ 'sqs-plain' => [ 'driver' => 'sqs-plain', 'key' => env('SQS_KEY', 'key'), 'secret' => env('SQS_SECRET', 'secret'), 'prefix' => env('SQS_PREFIX', 'prefix'), 'queue' => env('SQS_URL', 'queue'), 'region' => env('SQS_REGION', 'region'), ], 'sqs-plain-2' => [ 'driver' => 'sqs-plain-2', 'key' => env('SQS_KEY_2', 'key'), 'secret' => env('SQS_SECRET_2', 'secret'), 'prefix' => env('SQS_PREFIX_2', 'prefix'), 'queue' => env('SQS_URL_2', 'queue'), 'region' => env('SQS_REGION_2', 'region'), ] ]

what did I do to use multiple connections? whether I must do any configuration something for this?

Any suggestions would be helpful.

did you find an answer to this?

sshodges avatar Jun 04 '20 01:06 sshodges

You could just use different queues with a same driver.

        $object = [
            'music' => 'M.I.A. - Bad girls',
            'time' => time()
        ];
        $job = new DispatcherJob($object);

        dispatch($job->setPlain())->onConnection('sqs-plain')->onQueue('LaravelTestQueue2');

The name of the queue matches the one you created on AWS. The name of the driver can also be specified other than the default one. But for your use case, you don't need a different driver.

pixnbit avatar Mar 14 '21 01:03 pixnbit