laravel-plain-sqs
laravel-plain-sqs copied to clipboard
Can I using multiple connections for sending or listen queues?
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.
Can you explain your use case ? Why different drivers ?
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?
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.