dusterio / laravel-plain-sqs

Custom SQS connector for Laravel (or Lumen) that supports third-party, plain JSON messages
MIT License
131 stars 92 forks source link

Listening to multiple SQS queue #50

Open SarahTeoh opened 2 years ago

SarahTeoh commented 2 years ago

In the README, you mentioned that the config matches SQS queues with handler classes.

return [
    'handlers' => [
        'base-integrations-updates' => App\Jobs\HandlerJob::class,
    ],

    'default-handler' => App\Jobs\HandlerJob::class
];

However, in the config/queue.php example, you only specify one queue prefix.

        ...
        'sqs-plain' => [
            'driver' => 'sqs-plain',
            'key'    => env('AWS_KEY', ''),
            'secret' => env('AWS_SECRET', ''),
            'prefix' => 'https://sqs.ap-southeast-2.amazonaws.com/123123/',   // <-- only 1 queue prefix
            'queue'  => 'important-music-updates',
            'region' => 'ap-southeast-2',
        ],
        ...

How to listen to multiple SQS queues? Do I need to write extra configuration to listen to multiple queues?

dusterio commented 2 years ago

Just add a sqs-plain2 driver in the config?

hotaru-ishibashi commented 1 month ago

specify comma-separated queue 'name' in command like below

php artisan queue:work sqs-plain --queue=high-priority-queue,low-priority-queue

'name' is just queue name of SQS(after prefix). and you don't have to define name in config(config is just default value)

if you want to listen to multiple queue across prefix (across region), maybe you cannot do it in one command. so you need to define another driver, and manage priority yourself