Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yiisolutions/yii2-queue
Yii2 Queue
https://github.com/yiisolutions/yii2-queue
amqp queue rabbitmq yii2 yii2-queue
Last synced: 5 days ago
JSON representation
Yii2 Queue
- Host: GitHub
- URL: https://github.com/yiisolutions/yii2-queue
- Owner: yiisolutions
- License: bsd-3-clause
- Created: 2017-04-27T19:33:13.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-04-30T12:34:41.000Z (over 7 years ago)
- Last Synced: 2024-12-07T23:37:25.694Z (27 days ago)
- Topics: amqp, queue, rabbitmq, yii2, yii2-queue
- Language: PHP
- Size: 5.86 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Yii2 Queue
Extension for work with queues.
## Installation
Use composer
```
composer require "yiisolutions/yii2-migrations-advanced: *"
```or add to composer.json require section:
```
"yiisolutions/yii2-migrations-advanced": "*"
```## Configuration
First, we add to the configuration component.
```php
[
// ...
'queue' => [
'class' => 'yisolutions\queue\Queue',
'host' => 'localhost',
'port' => 5672,
'user' => 'guest',
'password' => 'guest',
'vhost' => '/',
],
// ...
],
// ...
];
```## Send data
Next, to send data to the queue, we use the send() component method.
```php
'bar'];/** @var Queue $queue */
$queue = Yii::$app->get('queue');
$queue->send('queue.name', $data);
```## Receive data
We use the listen method to retrieve data.
```php
get('queue');
$queue->listen('queue.name', function(AMQPMessage $msg) use ($queue) {
// process data
// acknowledgment message
$queue->acknowledgmentMessage($msg);
});
```