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:
Yii::$app->queue->getChannel('default')->push(
new MessageModel([
'worker' => 'test',
'method' => 'actionSayHello',
'arguments' => [
'say' => 'hello!'
]
])
);
\Yii::$app->queue->startDaemon();