argayash / yii2-queue
The queue extension for the Yii framework
Installs: 17
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 33
Type:yii2-extension
Requires
- yiisoft/yii2: ~2.0.0
Requires (Dev)
- amphp/amp: ^1
This package is not auto-updated.
Last update: 2024-11-01 19:34:20 UTC
README
Yii 2.0 Queue Extension
Non blocking queue manager for Yii 2.0
#####Install:
php composer.phar require argayash/yii2-queue "dev-hakaton-tass"
#####Config:
'components' => [ 'queue' => [ 'class' => \yii\queue\components\QueueComponent::className(), 'queueName' => 'default-queue', 'timeout' => 50, // optional 'workers' => [ 'test' => [ 'class' => \yii\queue\components\WorkerComponent::className(), 'action' => [ 'class' => \console\controllers\TestController::className(), ] ], ... ], 'channels' => [ 'default' => [ 'class' => \yii\queue\components\ChannelComponent::className(), 'driver' => [ 'class' => \yii\queue\drivers\MysqlConnection::className(), 'connection' => 'db' ] ] ], ... ] ] ]
Before use apply migrations:
./yii migrate/up --migrationPath=@vendor/argayash/yii2-queue/migrations
###Usage:
Push message to queue:
Yii::$app->queue->getChannel('default')->push( new MessageModel([ 'worker' => 'test', 'method' => 'actionSayHello', 'arguments' => [ 'say' => 'hello!' ] ]) );
Run queue worker daemon (console app):
\Yii::$app->queue->startDaemon();