flipboxdigital / queue
Simple queue
Installs: 2 419
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Open Issues: 0
Type:craft-plugin
Requires
- php: >=7.0
- craftcms/cms: ~3.0.0-beta.18
Requires (Dev)
- phpunit/phpunit: ^5.0
- squizlabs/php_codesniffer: ^2.0
- yiisoft/yii2-redis: *
This package is auto-updated.
Last update: 2024-11-09 13:23:17 UTC
README
This package provides a robust queue system for Craft CMS.
Installation
To install, use composer:
composer require flipboxdigital/queue
In the Craft Control Panel, go to Settings → Plugins and click the "Install" button for Queue.
Usage
By default, multiple queues are supported. In order to add a new queue, register it via an event in your Plugin::init()
:
yii\base\Event::on( flipbox\queue\queues\MultipleByEvent::class, flipbox\queue\queues\MultipleByEvent::EVENT_REGISTER_QUEUES, function(flipbox\queue\events\RegisterQueues $event) { $event->queues[] = [ 'class' => flipbox\queue\queues\Sqs::class, 'url' => 'https://sqs.us-west-2.amazonaws.com/1234567890/xxxxxx', 'config' => [ 'region' => 'us-west-2', 'version' => 'latest' ] ]; } );
To post a new job (extend flipbox\queue\jobs\AbstractJob
)
$job = new Your\Test\Job(); Queue::getInstance()->getQueue()->post($job);
To run a job:
$job = Queue::getInstance()->getQueue()->fetch(); if ($job) { Queue::getInstance()->getQueue()->run($job); }
Testing
$ ./vendor/bin/phpunit
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.