strong2much / yii2-queue
Helper classes for working with google products and technologies
Installs: 24
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 1
Open Issues: 0
Type:yii2-extension
Requires
- php: >=5.5
- strong2much/yii2-aws: dev-master
- yiisoft/yii2: *
This package is auto-updated.
Last update: 2024-12-05 07:29:16 UTC
README
This extension is using for works with different message queue services.
Installation
Install package by composer
{
"require": {
"strong2much/yii2-queue": "dev-master"
}
}
Or
$ composer require strong2much/yii2-queue "dev-master"
Use the following code in your configuration file. You can use different services
'queue' => [ 'class' => 'strong2much\queue\QueueManager' 'serviceConfig' => [ 'class' => 'strong2much\queue\services\DummyQueue', ] ]
Then you can send messages like so:
$msg = new \strong2much\queue\messages\TestMessage(); $msg->id = 1; $msg->message = "Some text"; if($msg->send()) { echo "OK"; }
Then you can use manager to handle your messages
//To receive messages $route = 'mq_test'; //just for example $message = Yii::$app->queue->receiveMessage($route); //this will get first one message from the queue //if you specify some processing function in message model, //then you can call it like so if($message !== false) { Yii::app()->queue->processData($route, \yii\base\helpers\Json::decode($message)); }
In order to use DbQueue as your service, you will need to apply the provided migrations.