New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add AMQP interop based driver. #158
Merged
Merged
Changes from 9 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
ba7a8b4
Add Amqp interop based driver.
makasim 1ae568e
review fixes.
makasim e8374f0
address comments.
makasim 5739f4d
add advantages
makasim f7c2a19
fix typo
makasim a2d3c9d
address review comments.
makasim 1a66da3
Fixed changelog formatting [skip ci]
samdark f248f73
remove H_
makasim 7040946
Merge branch 'amqp-interop' of github.com:formapro-forks/yii2-queue i…
makasim d456b75
[amqp-interop] Fixes long sending of a message
makasim 8110ee8
re-add deprecation notes.
makasim 9cc7a49
add upgrade note.
makasim 0c35b9e
fix
makasim 0534ac4
Merge remote-tracking branch 'yii/master' into amqp-interop
makasim 32d3c76
Revert "[amqp-interop] Fixes long sending of a message"
makasim 0b20354
keep connection logic and setup broker one separatly
makasim 54e7299
remove setup command
makasim File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
AMQP Interop | ||
============ | ||
|
||
The driver works with RabbitMQ queues. | ||
|
||
In order for it to work you should add any [amqp interop](https://github.com/queue-interop/queue-interop#amqp-interop) compatible transport to your project, for example `enqueue/amqp-lib` package. | ||
|
||
Advantages: | ||
|
||
* It would work with any amqp interop compatible transports, such as | ||
|
||
* [enqueue/amqp-ext](https://github.com/php-enqueue/amqp-ext) based on [PHP amqp extension](https://github.com/pdezwart/php-amqp) | ||
* [enqueue/amqp-lib](https://github.com/php-enqueue/amqp-lib) based on [php-amqplib/php-amqplib](https://github.com/php-amqplib/php-amqplib) | ||
* [enqueue/amqp-bunny](https://github.com/php-enqueue/amqp-bunny) based on [bunny](https://github.com/jakubkulhan/bunny) | ||
|
||
* Supports priorities | ||
* Supports delays | ||
* Supports ttr | ||
* Supports attempts | ||
* Contains new options like: vhost, connection_timeout, qos_prefetch_count and so on. | ||
* Supports Secure (SSL) AMQP connections. | ||
* An ability to set DSN like: amqp:, amqps: or amqp://user:pass@localhost:1000/vhost | ||
|
||
Configuration example: | ||
|
||
```php | ||
return [ | ||
'bootstrap' => [ | ||
'queue', // The component registers own console commands | ||
], | ||
'components' => [ | ||
'queue' => [ | ||
'class' => \yii\queue\amqp_interop\Queue::class, | ||
'port' => 5672, | ||
'user' => 'guest', | ||
'password' => 'guest', | ||
'queueName' => 'queue', | ||
'driver' => yii\queue\amqp_interop\Queue::ENQUEUE_AMQP_LIB, | ||
|
||
// or | ||
'dsn' => 'amqp://guest:guest@localhost:5672/%2F', | ||
|
||
// or, same as above | ||
'dsn' => 'amqp:', | ||
], | ||
], | ||
]; | ||
``` | ||
|
||
Console | ||
------- | ||
|
||
Console is used to listen and process queued tasks. | ||
|
||
```sh | ||
yii queue/listen | ||
``` | ||
|
||
`listen` command launches a daemon which infinitely queries the queue. If there are new tasks | ||
they're immediately obtained and executed. This method is most efficient when command is properly | ||
daemonized via [supervisor](worker.md#supervisor). | ||
|
||
`listen` command has options: | ||
|
||
- `--verbose`, `-v`: print executing statuses into console. | ||
- `--isolate`: verbose mode of a job execute. If enabled, execute result of each job will be printed. | ||
- `--color`: highlighting for verbose mode. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
/** | ||
* @link http://www.yiiframework.com/ | ||
* @copyright Copyright (c) 2008 Yii Software LLC | ||
* @license http://www.yiiframework.com/license/ | ||
*/ | ||
|
||
namespace yii\queue\amqp_interop; | ||
|
||
use yii\queue\cli\Command as CliCommand; | ||
|
||
/** | ||
* Manages application amqp-queue. | ||
* | ||
* @author Maksym Kotliar <kotlyar.maksim@gmail.com> | ||
* @since 2.0.2 | ||
*/ | ||
class Command extends CliCommand | ||
{ | ||
/** | ||
* @var Queue | ||
*/ | ||
public $queue; | ||
|
||
/** | ||
* Listens amqp-queue and runs new jobs. | ||
* It can be used as demon process. | ||
*/ | ||
public function actionListen() | ||
{ | ||
$this->queue->listen(); | ||
} | ||
|
||
/** | ||
* Creates all required queues, topics etc | ||
*/ | ||
public function actionSetupBroker() | ||
{ | ||
$this->queue->setupBroker(); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@since 2.0.2
(or which version is it going to be released it, @zhuravljov ?)