mcfedr / sqs-queue-driver-bundle
A bundle for running symfony background tasks with SQS as the engine
Installs: 45 159
Dependents: 1
Suggesters: 0
Security: 0
Stars: 4
Watchers: 2
Forks: 4
Open Issues: 1
Type:symfony-bundle
Requires
- php: >=5.5
- aws/aws-sdk-php: ^3.15
- mcfedr/queue-manager-bundle: ^5.2
- symfony/framework-bundle: ^3.0|^4.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.1
- phpunit/phpunit: ^4.0|^5.3
- symfony/browser-kit: ^3.0|^4.0
- symfony/monolog-bundle: ^2.8|^3.0|^4.0
Suggests
- mcfedr/doctrine-delay-queue-driver-bundle: A driver to delay tasks, useful with sqs
README
A driver for Queue Manager Bundle that uses Amazon SQS
Usage
The sqs runner is a Symfony command. You can runner multiple instances if you need to handle higher numbers of jobs.
./bin/console mcfedr:queue:{name}-runner
Where {name}
is what you used in the config. Add -v
or more to get detailed logs.
Install
Composer
composer require mcfedr/sqs-queue-driver-bundle
AppKernel
Include the bundle in your AppKernel
public function registerBundles()
{
$bundles = [
...
new Mcfedr\QueueManagerBundle\McfedrQueueManagerBundle(),
new Mcfedr\SqsQueueDriverBundle\McfedrSqsQueueDriverBundle(),
Config
With this bundle installed you can setup your queue manager config similar to this:
mcfedr_queue_manager:
managers:
default:
driver: sqs
options:
default_url: https://sqs.eu-west-1.amazonaws.com/...
region: eu-west-1
credentials:
key: 'my-access-key-id'
secret: 'my-secret-access-key'
queues:
name: https://sqs.eu-west-1.amazonaws.com/...
name2: https://sqs.eu-west-1.amazonaws.com/...
This will create a QueueManager
service named "mcfedr_queue_manager.default"
default_url
- Default SQS queue urlregion
required - The region where your queue iscredentials
optional - Specify your key and secret This is optional because the SDK can pick up your credentials from a variety of placesqueues
optional - Allows you to setup a mapping of short names for queues, this makes it easier to use multiple queues and keep the config in one place
Options to QueueManager::put
url
- Astring
with the url of a queuequeue
- Astring
with the name of a queue in the configtime
- A\DateTime
object of when to schedule this job. Note: SQS can delay jobs up to 15 minutesdelay
- Number of seconds from now to schedule this job. Note: SQS can delay jobs up to 15 minutesvisibilityTimeout
- Number of seconds during which Amazon SQS prevents other consumers from receiving and processing the message.