bazilio91 / Yii2 Async
Licence: mit
Provides translucent api & queues for moving large tasks out of request context with SQL, Redis or AMQP.
Stars: ✭ 64
Projects that are alternatives of or similar to Yii2 Async
Yii2 Queue
Yii2 Queue Extension. Supports DB, Redis, RabbitMQ, Beanstalk and Gearman
Stars: ✭ 977 (+1426.56%)
Mutual labels: redis, yii2, queue, amqp
Stacker
Stacker - The environment for local web development, ready for use.
Stars: ✭ 356 (+456.25%)
Mutual labels: mysql, redis, yii2
Imi
imi 是基于 Swoole 的 PHP 协程开发框架,它支持 Http、Http2、WebSocket、TCP、UDP、MQTT 等主流协议的服务开发,特别适合互联网微服务、即时通讯聊天im、物联网等场景!。QQ群:17916227
Stars: ✭ 680 (+962.5%)
Mutual labels: mysql, redis, amqp
Machinery
Machinery is an asynchronous task queue/job queue based on distributed message passing.
Stars: ✭ 5,821 (+8995.31%)
Mutual labels: redis, queue, amqp
Sidekiq Job Php
Push and schedule jobs to Sidekiq from PHP
Stars: ✭ 34 (-46.87%)
Mutual labels: redis, queue
Nagios Plugins
450+ AWS, Hadoop, Cloud, Kafka, Docker, Elasticsearch, RabbitMQ, Redis, HBase, Solr, Cassandra, ZooKeeper, HDFS, Yarn, Hive, Presto, Drill, Impala, Consul, Spark, Jenkins, Travis CI, Git, MySQL, Linux, DNS, Whois, SSL Certs, Yum Security Updates, Kubernetes, Cloudera etc...
Stars: ✭ 1,000 (+1462.5%)
Mutual labels: mysql, redis
Phalcon Vm
Vagrant configuration for PHP7, Phalcon 3.x and Zephir development.
Stars: ✭ 43 (-32.81%)
Mutual labels: mysql, redis
Wait4x
Wait4X is a cli tool to wait for everything! It can be wait for a port to open or enter to rquested state.
Stars: ✭ 30 (-53.12%)
Mutual labels: mysql, redis
Finagle
A fault tolerant, protocol-agnostic RPC system
Stars: ✭ 8,126 (+12596.88%)
Mutual labels: mysql, redis
Mrseedbox
[unmaintained] A Containerized Seedbox with Embedded Media Player
Stars: ✭ 30 (-53.12%)
Mutual labels: mysql, redis
Drupal Nginx Php Kubernetes
Demonstration of a set of NGINX and PHP-FPM containers running Drupal deployed to Kubernetes on the IBM Container Service. This is a work in progress.
Stars: ✭ 43 (-32.81%)
Mutual labels: mysql, redis
Photo Blog
The Photo Blog Application based on Laravel 5 and Vue.js 2 + Prerender
Stars: ✭ 55 (-14.06%)
Mutual labels: mysql, redis
Duckygo
一个同时支持Session以及JWT的高性能高可用 Golang Restful API 脚手架 !
Stars: ✭ 57 (-10.94%)
Mutual labels: mysql, redis
yii2-async
Provides translucent api for moving large tasks out of request response
Install: php composer.phar require bazilio/yii2-async:dev-master
Requirments:
- php >=5.4
- Transports:
yii\db\Connection
- php-amqp
- yii2-redis
Using with AMQP:
php composer.phar require pdezwart/php-amqp:dev-master
main.php:
'components' => [
'async' => [
'class' => 'bazilio\async\AsyncComponent',
'transportClass' => 'bazilio\async\transports\AsyncAmqpTransport',
'transportConfig' => [
'host' => 'localhost',
'login' => 'guest',
'password' => 'guest',
'vhost' => 'yii',
'exchangeName' => 'yii'
]
]
]
Using with Redis:
php composer.phar require yiisoft/yii2-redis:*
main.php:
'components' => [
'redis' => [
'class' => 'yii\redis\Connection',
'hostname' => 'localhost',
'port' => 6379,
'database' => 0,
'dataTimeout' => -1, // important for daemon and blocking queries
],
'async' => [
'class' => 'bazilio\async\AsyncComponent',
'transportClass' => 'bazilio\async\transports\AsyncRedisTransport',
'transportConfig' => [
'connection' => 'redis',
]
]
]
Using with MySQL (probably any sql, but tested only with mysql)
main.php:
'components' => [
'db' => [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=yii2advenced',
'username' => 'root',
'password' => '',
'charset' => 'utf8',
],
'async' => [
'class' => 'bazilio\async\AsyncComponent',
'transportClass' => 'bazilio\async\transports\AsyncMysqlTransport',
'transportConfig' => [
'connection' => 'db',
]
]
]
Apply migrations:
./yii migrate/up --migrationPath[email protected]vendor/bazilio/yii2-async/migrations
Usage:
Create and send:
Test class example:
class DownloadTask extends AsyncTask
{
public $url;
public $file;
public static $queueName = 'downloads';
public function execute()
{
return file_put_contents($this->file, file_get_contents($this->url));
}
}
// create task
$task = new DownloadTask(['url' => 'http://localhost/', 'file' => '/tmp/localhost.html']);
\Yii::$app->async->sendTask($task);
Or call external method:
$task = new AsyncExecuteTask([
'class' => 'common\components\MyDownloaderComponent',
'method' => 'download',
'arguments' => ['url' => 'http://localhost/', 'file' => '/tmp/localhost.html']
]);
$task::$queueName = 'downloads';
if (YII_ENV !== 'prod') {
$task->execute();
} else {
Yii::$app->async->sendTask($task);
}
Execute:
Bash way:
Fill console config:
'controllerMap' => [
'async-worker' => [
'class' => 'bazilio\async\commands\AsyncWorkerCommand',
],
],
Run:
# Process and exit on finish
./yii async-worker/execute downloads
# Process and wait for new tasks (only redis)
./yii async-worker/daemon downloads
Code way:
while ($task = \Yii::$app->async->receiveTask('downloads')) {
if ($task->execute()) {
\Yii::$app->async->acknowledgeTask($task);
}
}
For more code examples look into tests:
Runing tests:
vendor/bin/codecept run
Or in Docker:
./test.sh
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].